summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-07-24 03:02:17 -0400
committerRich Felker <dalias@aerifal.cx>2014-07-24 03:02:17 -0400
commit674e28af2deaa3ef2b71af18f7a18af22467d5ef (patch)
tree713e03d4430a54fe51be66069efb32b7b2fe9d98 /src
parent871a09c86ff3466196c3bfded84c5bbeb0b07f81 (diff)
downloadmusl-674e28af2deaa3ef2b71af18f7a18af22467d5ef.tar.gz
musl-674e28af2deaa3ef2b71af18f7a18af22467d5ef.tar.bz2
musl-674e28af2deaa3ef2b71af18f7a18af22467d5ef.tar.xz
musl-674e28af2deaa3ef2b71af18f7a18af22467d5ef.zip
fix locale environment variable logic for empty strings
per POSIX (XBD 8.2) LC_*/LANG environment variables set to to the empty string are supposed to be treated as if they were not set at all.
Diffstat (limited to 'src')
-rw-r--r--src/locale/__setlocalecat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/locale/__setlocalecat.c b/src/locale/__setlocalecat.c
index f1e4bf07..a947dbff 100644
--- a/src/locale/__setlocalecat.c
+++ b/src/locale/__setlocalecat.c
@@ -16,9 +16,9 @@ static const char envvars[][12] = {
int __setlocalecat(locale_t loc, int cat, const char *val)
{
if (!*val) {
- (val = getenv("LC_ALL")) ||
- (val = getenv(envvars[cat])) ||
- (val = getenv("LANG")) ||
+ (val = getenv("LC_ALL")) && *val ||
+ (val = getenv(envvars[cat])) && *val ||
+ (val = getenv("LANG")) && *val ||
(val = "C.UTF-8");
}