diff options
Diffstat (limited to 'src/stdio/__fdopen.c')
-rw-r--r-- | src/stdio/__fdopen.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/stdio/__fdopen.c b/src/stdio/__fdopen.c index 07f966a5..8bd51c66 100644 --- a/src/stdio/__fdopen.c +++ b/src/stdio/__fdopen.c @@ -7,7 +7,10 @@ FILE *__fdopen(int fd, const char *mode) int plus = !!strchr(mode, '+'); /* Check for valid initial mode character */ - if (!strchr("rwa", *mode)) return 0; + if (!strchr("rwa", *mode)) { + errno = EINVAL; + return 0; + } /* Allocate FILE+buffer or fail */ if (!(f=malloc(sizeof *f + UNGET + BUFSIZ))) return 0; |