diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-12-24 19:55:40 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-12-24 19:55:40 +0000 |
commit | 9e31d9c03b0ae59232651f5630e31c009ead110f (patch) | |
tree | 9676399ea543256f0ef6c27e019f1697aa77588f /lib/libc | |
parent | b7c254243fdfd92e3402e3fe0568c409bef9b629 (diff) |
Both our manual and POSIX ask us to set the error indicator when an
encoding error occurs, so do it.
While here, do not set errno after mbrtowc(3) failure; mbrtowc(3)
already does that, and that behaviour is required by the standard.
ok jca@ guenther@ "nice find" deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/stdio/fgetwc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/stdio/fgetwc.c b/lib/libc/stdio/fgetwc.c index 6c850cc9680..2e69191f194 100644 --- a/lib/libc/stdio/fgetwc.c +++ b/lib/libc/stdio/fgetwc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fgetwc.c,v 1.5 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: fgetwc.c,v 1.6 2015/12/24 19:55:39 schwarze Exp $ */ /* $NetBSD: fgetwc.c,v 1.3 2003/03/07 07:11:36 tshiozak Exp $ */ /*- @@ -69,7 +69,7 @@ __fgetwc_unlock(FILE *fp) c = ch; size = mbrtowc(&wc, &c, 1, st); if (size == (size_t)-1) { - errno = EILSEQ; + fp->_flags |= __SERR; return WEOF; } } while (size == (size_t)-2); |