summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale/wcrtomb.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/locale/wcrtomb.c')
-rw-r--r--lib/libc/locale/wcrtomb.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libc/locale/wcrtomb.c b/lib/libc/locale/wcrtomb.c
index 722e5c1..5f79949 100644
--- a/lib/libc/locale/wcrtomb.c
+++ b/lib/libc/locale/wcrtomb.c
@@ -34,6 +34,9 @@ extern size_t (*__wcrtomb)(char * __restrict, wchar_t, mbstate_t * __restrict);
size_t
wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
{
+ static mbstate_t mbs;
+ if (ps == NULL)
+ ps = &mbs;
return (__wcrtomb(s, wc, ps));
}
OpenPOWER on IntegriCloud