diff options
author | Jakob Kaivo <jkk@ung.org> | 2020-08-12 16:00:52 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2020-08-12 16:00:52 -0400 |
commit | 24ca03515a8c1c8e640231650254372b31a8a809 (patch) | |
tree | f85a1a3bd4fb51f9459a5403ae13d7db3efa15fb /src/stdio | |
parent | 72d67158f211d46fcd1deddf3c256472d7c50163 (diff) |
allow for cases when O_RDONLY is 0
Diffstat (limited to 'src/stdio')
-rw-r--r-- | src/stdio/freopen.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/stdio/freopen.c b/src/stdio/freopen.c index 2bb4420c..c9c28dba 100644 --- a/src/stdio/freopen.c +++ b/src/stdio/freopen.c @@ -38,7 +38,7 @@ FILE * freopen(const char * restrict filename, const char * restrict mode, FILE { "ab+", O_RDWR | O_CREAT | O_APPEND }, { "a+b", O_RDWR | O_CREAT | O_APPEND }, }; - int openmode = 0; + int openmode = -1; size_t i; int fd = -1; @@ -51,7 +51,7 @@ FILE * freopen(const char * restrict filename, const char * restrict mode, FILE } } - if (openmode == 0) { + if (openmode == -1) { #ifdef EINVAL errno = EINVAL; #endif |