summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/fgetwc.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2015-12-24 19:55:39 +0000
committerschwarze <schwarze@openbsd.org>2015-12-24 19:55:39 +0000
commit7dc2d46981f70de7a1b2467a30152d89428f692a (patch)
tree3a0afb994201dfe971a03e4c0b4ae7ccf35ea6bf /lib/libc/stdio/fgetwc.c
parentMake all instances of gpt_chk_mbr() identical (bar static vs (diff)
downloadwireguard-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.c4
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);