projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make fgetwc set error indicator for stream on encoding errors
[musl]
/
src
/
stdio
/
fgetwc.c
diff --git
a/src/stdio/fgetwc.c
b/src/stdio/fgetwc.c
index
0801e28
..
aa10b81
100644
(file)
--- a/
src/stdio/fgetwc.c
+++ b/
src/stdio/fgetwc.c
@@
-25,12
+25,18
@@
static wint_t __fgetwc_unlocked_internal(FILE *f)
do {
b = c = getc_unlocked(f);
if (c < 0) {
do {
b = c = getc_unlocked(f);
if (c < 0) {
- if (!first) errno = EILSEQ;
+ if (!first) {
+ f->flags |= F_ERR;
+ errno = EILSEQ;
+ }
return WEOF;
}
l = mbrtowc(&wc, (void *)&b, 1, &st);
if (l == -1) {
return WEOF;
}
l = mbrtowc(&wc, (void *)&b, 1, &st);
if (l == -1) {
- if (!first) ungetc(b, f);
+ if (!first) {
+ f->flags |= F_ERR;
+ ungetc(b, f);
+ }
return WEOF;
}
first = 0;
return WEOF;
}
first = 0;