projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
57d5fff
)
fdopen should set errno when it fails due to invalid mode string
author
Rich Felker
<dalias@aerifal.cx>
Mon, 18 Jun 2012 00:34:04 +0000
(20:34 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Mon, 18 Jun 2012 00:34:04 +0000
(20:34 -0400)
src/stdio/__fdopen.c
patch
|
blob
|
history
diff --git
a/src/stdio/__fdopen.c
b/src/stdio/__fdopen.c
index 07f966a5a6556641946962082c3cab0042522f9a..8bd51c66e7efbfa61b2d8875061eced89c46f4ae 100644
(file)
--- 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;