summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/fputwc.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-10-16 12:09:43 +0000
committertjr <tjr@FreeBSD.org>2002-10-16 12:09:43 +0000
commit3a88c84c050889dfcdf58a721602c40f9ae03a96 (patch)
tree47fcbdba053baaebb80400ad1d663fa57af766bc /lib/libc/stdio/fputwc.c
parentccd9275d4ea58567606a870a1c0faabbbabd889b (diff)
downloadFreeBSD-src-3a88c84c050889dfcdf58a721602c40f9ae03a96.zip
FreeBSD-src-3a88c84c050889dfcdf58a721602c40f9ae03a96.tar.gz
Set the error bit on the stream if an encoding error occurs. Improve
handling of multibyte sequences representing null wide characters.
Diffstat (limited to 'lib/libc/stdio/fputwc.c')
-rw-r--r--lib/libc/stdio/fputwc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/stdio/fputwc.c b/lib/libc/stdio/fputwc.c
index 10c3c18..1f42ce9 100644
--- a/lib/libc/stdio/fputwc.c
+++ b/lib/libc/stdio/fputwc.c
@@ -57,8 +57,10 @@ __fputwc(wchar_t wc, FILE *fp)
len = 1;
} else {
memset(&mbs, 0, sizeof(mbs));
- if ((len = wcrtomb(buf, wc, &mbs)) == (size_t)-1)
+ if ((len = wcrtomb(buf, wc, &mbs)) == (size_t)-1) {
+ fp->_flags |= __SERR;
return (WEOF);
+ }
}
for (i = 0; i < len; i++)
OpenPOWER on IntegriCloud