diff options
author | ache <ache@FreeBSD.org> | 2000-09-01 11:13:38 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2000-09-01 11:13:38 +0000 |
commit | abfec47a85e6e655b18dae0750d1dcf5b7731cf6 (patch) | |
tree | 806ab568740707cff1405d26b678313685d0388d /lib/libc | |
parent | fea9bbdd8546b0c87c2f1333f91f7a515acef161 (diff) | |
download | FreeBSD-src-abfec47a85e6e655b18dae0750d1dcf5b7731cf6.zip FreeBSD-src-abfec47a85e6e655b18dae0750d1dcf5b7731cf6.tar.gz |
setlocale may return NULL, handle this case too by resetting to "C"
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/nls/msgcat.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libc/nls/msgcat.c b/lib/libc/nls/msgcat.c index 4dba0cd..f02af8e 100644 --- a/lib/libc/nls/msgcat.c +++ b/lib/libc/nls/msgcat.c @@ -107,11 +107,9 @@ int type; } else { if (type == NL_CAT_LOCALE) lang = setlocale(LC_MESSAGES, NULL); - else { - if ((lang = (char *) getenv("LANG")) == NULL) - lang = "C"; - } - if (strchr(lang, '/') != NULL) + else + lang = getenv("LANG"); + if (lang == NULL || strchr(lang, '/') != NULL) lang = "C"; if ((nlspath = (char *) getenv("NLSPATH")) == NULL #ifndef __NETBSD_SYSCALLS |