diff options
Diffstat (limited to 'newlib/libc/stdio/flags.c')
-rw-r--r-- | newlib/libc/stdio/flags.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/newlib/libc/stdio/flags.c b/newlib/libc/stdio/flags.c index 6d62bd5..e448cca 100644 --- a/newlib/libc/stdio/flags.c +++ b/newlib/libc/stdio/flags.c @@ -61,19 +61,19 @@ __sflags (ptr, mode, optr) ptr->_errno = EINVAL; return (0); } - if (mode[1] == '+' || mode[2] == '+') + if (mode[1] && (mode[1] == '+' || mode[2] == '+')) { ret = __SRW; m = O_RDWR; } - if (mode[1] == 'b' || mode[2] == 'b') + if (mode[1] && (mode[1] == 'b' || mode[2] == 'b')) { #ifdef O_BINARY m |= O_BINARY; #endif } #ifdef __CYGWIN__ - else if (mode[1] == 't' || mode[2] == 't') + else if (mode[1] && (mode[1] == 't' || mode[2] == 't')) #else else #endif |