From 24ca03515a8c1c8e640231650254372b31a8a809 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Wed, 12 Aug 2020 16:00:52 -0400 Subject: allow for cases when O_RDONLY is 0 --- src/stdio/freopen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/stdio') 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 -- cgit v1.2.1