diff options
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/locale/wcrtomb.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/locale/wcrtomb.c b/lib/libc/locale/wcrtomb.c index a76f03159386..7bebd1ad97bf 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; |
