diff options
author | ache <ache@FreeBSD.org> | 2008-01-23 01:57:26 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2008-01-23 01:57:26 +0000 |
commit | 76c6a978cca445992be3228df0af5c665fbc1083 (patch) | |
tree | e169dad5cb0f18af1918902a686ae6c3c13544ee | |
parent | 66dc6c3da87711400e78c3e022ccf201cb79fb8f (diff) | |
download | FreeBSD-src-76c6a978cca445992be3228df0af5c665fbc1083.zip FreeBSD-src-76c6a978cca445992be3228df0af5c665fbc1083.tar.gz |
1) Add (void) cast to _none_init() (while I am here)
2) Fix longstanding segfault in mb/wc code when unknown encoding is specified
in the locale file (mb/wc functions becomes NULL in that case).
-rw-r--r-- | lib/libc/locale/setrunelocale.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/locale/setrunelocale.c b/lib/libc/locale/setrunelocale.c index e619e0b..4e36eb7 100644 --- a/lib/libc/locale/setrunelocale.c +++ b/lib/libc/locale/setrunelocale.c @@ -77,7 +77,7 @@ __setrunelocale(const char *encoding) * The "C" and "POSIX" locale are always here. */ if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0) { - _none_init(&_DefaultRuneLocale); + (void) _none_init(&_DefaultRuneLocale); return (0); } @@ -142,8 +142,10 @@ __setrunelocale(const char *encoding) ret = _BIG5_init(rl); else if (strcmp(rl->__encoding, "MSKanji") == 0) ret = _MSKanji_init(rl); - else + else { + (void) _none_init(&_DefaultRuneLocale); ret = EFTYPE; + } if (ret == 0) { if (CachedRuneLocale != NULL) { /* See euc.c */ |