toolchain: uClibc: mbrtowc(): set output to NULL in case of empty input string like...
[tomato.git] / toolchain / toolchain / uClibc / patches / 0.9.30.1 / 601-wchar-intlassert.patch
blob8302018b177e2348de38cf172bff8c76cc8f01f6
1 mbrtowc: set output to NULL in case of empty input string like glibc does.
3 https://bugs.busybox.net/show_bug.cgi?id=1471
5 --- a/libc/misc/wchar/wchar.c 2008-12-02 20:15:35.000000000 +0300
6 +++ b/libc/misc/wchar/wchar.c 2010-11-22 20:23:52.000000000 +0300
7 @@ -295,6 +295,8 @@ size_t mbrtowc(wchar_t *__restrict pwc,
8 n = 1;
9 } else if (*s == '\0') {
10 /* According to the ISO C 89 standard this is the expected behaviour. */
11 + if (pwc)
12 + *pwc = 0;
13 return 0;
14 } else if (!n) {
15 /* TODO: change error code? */