summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2008-01-23 01:57:26 +0000
committerache <ache@FreeBSD.org>2008-01-23 01:57:26 +0000
commit76c6a978cca445992be3228df0af5c665fbc1083 (patch)
treee169dad5cb0f18af1918902a686ae6c3c13544ee /lib/libc/locale
parent66dc6c3da87711400e78c3e022ccf201cb79fb8f (diff)
downloadFreeBSD-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).
Diffstat (limited to 'lib/libc/locale')
-rw-r--r--lib/libc/locale/setrunelocale.c6
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 */
OpenPOWER on IntegriCloud