mbsinit (NULL) is required to return 1. But gnulib's replacement does not do it. This fixes it:
2011-02-13 Bruno Haible <[email protected]> mbsinit: Don't crash for a NULL argument. * lib/mbsinit.c (mbsinit): When the argument is NULL, return 1. * tests/test-mbsinit.c (mbsinit): Check this behaviour. --- lib/mbsinit.c.orig Sun Feb 13 18:02:57 2011 +++ lib/mbsinit.c Sun Feb 13 18:01:55 2011 @@ -43,5 +43,5 @@ { const char *pstate = (const char *)ps; - return pstate[0] == 0; + return pstate == NULL || pstate[0] == 0; } --- tests/test-mbsinit.c.orig Sun Feb 13 18:02:57 2011 +++ tests/test-mbsinit.c Sun Feb 13 18:02:09 2011 @@ -32,6 +32,8 @@ { static mbstate_t state; + ASSERT (mbsinit (NULL)); + ASSERT (mbsinit (&state)); if (argc > 1) -- In memoriam Alexander Samoylovich <http://en.wikipedia.org/wiki/Alexander_Samoylovich>
