From 674e28af2deaa3ef2b71af18f7a18af22467d5ef Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 24 Jul 2014 03:02:17 -0400 Subject: 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. --- src/locale/__setlocalecat.c | 6 +++--- 1 file 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"); } -- cgit v1.2.1