From e3e8878435ea88f45bce56e6d49e962bbdcf6547 Mon Sep 17 00:00:00 2001 From: "Tim J. Robbins" Date: Thu, 10 Apr 2003 09:20:38 +0000 Subject: [PATCH] When called with s == NULL, behave as if wc == L'\0' as required by the standard. --- lib/libc/locale/wcrtomb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libc/locale/wcrtomb.c b/lib/libc/locale/wcrtomb.c index a76f0315938..7bebd1ad97b 100644 --- a/lib/libc/locale/wcrtomb.c +++ b/lib/libc/locale/wcrtomb.c @@ -39,8 +39,10 @@ wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps __unused) char *e; char buf[MB_LEN_MAX]; - if (s == NULL) + if (s == NULL) { s = buf; + wc = L'\0'; + } sputrune(wc, s, MB_CUR_MAX, &e); if (e == NULL) { errno = EILSEQ;