mirror of
https://git.musl-libc.org/git/musl
synced 2025-02-13 16:54:16 +03:00
fix failure of getdelim to set stream orientation on error
if EINVAL or ENOMEM happened before the first getc_unlocked, it was possible that the stream orientation had not yet been set.
This commit is contained in:
parent
5994de4e02
commit
5cd309f0cc
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user