X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2F__fdopen.c;h=8bd51c66e7efbfa61b2d8875061eced89c46f4ae;hb=8c0a3d9e5c169fc9d0f246ab59362b658b029ad7;hp=07f966a5a6556641946962082c3cab0042522f9a;hpb=dba68bf98fc708cea4c478278c889fc7ad802b00;p=musl 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;