fix failure of mbsinit(0) (not UB; required to return nonzero)
authorRich Felker <dalias@aerifal.cx>
Sat, 26 May 2012 22:02:45 +0000 (18:02 -0400)
committerRich Felker <dalias@aerifal.cx>
Sat, 26 May 2012 22:02:45 +0000 (18:02 -0400)
issue reported by Richard Pennington; slightly simpler fix applied

src/multibyte/mbsinit.c

index d307e5a719e99b8a6c3e86b23050697e5673806e..c0e7e494232a91802c0430e391bc128dd9ce4d6d 100644 (file)
@@ -13,5 +13,5 @@
 
 int mbsinit(const mbstate_t *st)
 {
-       return !*(unsigned *)st;
+       return !st || !*(unsigned *)st;
 }