diff options
author | tjr <tjr@FreeBSD.org> | 2003-04-10 09:20:38 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2003-04-10 09:20:38 +0000 |
commit | 00b5bfa4c1d079fe2f6ecc46cf39a6e3e747cdc4 (patch) | |
tree | 8b968f59182a9e4146766987ede1f1fb6c47ae80 | |
parent | cf8fc64746affc0aee03d8ba73abe3304831bbd7 (diff) | |
download | FreeBSD-src-00b5bfa4c1d079fe2f6ecc46cf39a6e3e747cdc4.zip FreeBSD-src-00b5bfa4c1d079fe2f6ecc46cf39a6e3e747cdc4.tar.gz |
When called with s == NULL, behave as if wc == L'\0' as required by the
standard.
-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 a76f031..7bebd1a 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; |