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:
5994de4
)
fix failure of getdelim to set stream orientation on error
author
Rich Felker
<dalias@aerifal.cx>
Sun, 16 Sep 2018 12:40:46 +0000
(08:40 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Sun, 16 Sep 2018 12:46:26 +0000
(08:46 -0400)
if EINVAL or ENOMEM happened before the first getc_unlocked, it was
possible that the stream orientation had not yet been set.
src/stdio/getdelim.c
patch
|
blob
|
history
diff --git
a/src/stdio/getdelim.c
b/src/stdio/getdelim.c
index 26a56780ede5715f3961d8ce51efc78830d4b194..60c6cc18677380a3e8c63fbe9439c20a235a6b32 100644
(file)
--- a/
src/stdio/getdelim.c
+++ b/
src/stdio/getdelim.c
@@
-15,6
+15,7
@@
ssize_t getdelim(char **restrict s, size_t *restrict n, int delim, FILE *restric
FLOCK(f);
if (!n || !s) {
+ f->mode |= f->mode-1;
f->flags |= F_ERR;
FUNLOCK(f);
errno = EINVAL;
@@
-58,6
+59,7
@@
ssize_t getdelim(char **restrict s, size_t *restrict n, int delim, FILE *restric
return i;
oom:
+ f->mode |= f->mode-1;
f->flags |= F_ERR;
FUNLOCK(f);
errno = ENOMEM;