diff --git a/distrib/utils/libhack/multibyte.c b/distrib/utils/libhack/multibyte.c index 4955d1bd1efc..a63ee1de0c1d 100644 --- a/distrib/utils/libhack/multibyte.c +++ b/distrib/utils/libhack/multibyte.c @@ -1,4 +1,4 @@ -/* $NetBSD: multibyte.c,v 1.5 2013/04/19 18:45:03 joerg Exp $ */ +/* $NetBSD: multibyte.c,v 1.6 2014/11/15 17:49:19 christos Exp $ */ /* * Ignore all multibyte sequences, removes all the citrus code. @@ -12,7 +12,15 @@ size_t mbrtowc(wchar_t *wc, const char *str, size_t max_sz, mbstate_t *ps) { - return str == NULL || (*wc = (unsigned char)*str) == 0 ? 0 : 1; + wchar_t c; + + if (str == NULL) + return 0; + + if (wc != NULL) + *wc = (unsigned char)*str; + + return *str == '\0' ? 0 : 1; } size_t