diff options
author | 2015-12-24 19:55:39 +0000 | |
---|---|---|
committer | 2015-12-24 19:55:39 +0000 | |
commit | 7dc2d46981f70de7a1b2467a30152d89428f692a (patch) | |
tree | 3a0afb994201dfe971a03e4c0b4ae7ccf35ea6bf /lib/libc/stdio/fgetwc.c | |
parent | Make all instances of gpt_chk_mbr() identical (bar static vs (diff) | |
download | wireguard-openbsd-7dc2d46981f70de7a1b2467a30152d89428f692a.tar.xz wireguard-openbsd-7dc2d46981f70de7a1b2467a30152d89428f692a.zip |
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/stdio/fgetwc.c')
-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); |