When called with s == NULL, behave as if wc == L'\0' as required by the

standard.
This commit is contained in:
Tim J. Robbins 2003-04-10 09:20:38 +00:00
parent 5bff20ef7c
commit e3e8878435

View file

@ -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;