From 6180233fd804806e7301790d2330da50ca57e71f Mon Sep 17 00:00:00 2001 From: "Tim J. Robbins" Date: Wed, 16 Oct 2002 12:09:43 +0000 Subject: Set the error bit on the stream if an encoding error occurs. Improve handling of multibyte sequences representing null wide characters. --- lib/libc/stdio/fputwc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/libc/stdio/fputwc.c') diff --git a/lib/libc/stdio/fputwc.c b/lib/libc/stdio/fputwc.c index 10c3c18a5c45..1f42ce9e808a 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++) -- cgit v1.2.3