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.
This commit is contained in:
parent
871a09c86f
commit
674e28af2d
1 changed files with 3 additions and 3 deletions
|
|
@ -16,9 +16,9 @@ static const char envvars[][12] = {
|
||||||
int __setlocalecat(locale_t loc, int cat, const char *val)
|
int __setlocalecat(locale_t loc, int cat, const char *val)
|
||||||
{
|
{
|
||||||
if (!*val) {
|
if (!*val) {
|
||||||
(val = getenv("LC_ALL")) ||
|
(val = getenv("LC_ALL")) && *val ||
|
||||||
(val = getenv(envvars[cat])) ||
|
(val = getenv(envvars[cat])) && *val ||
|
||||||
(val = getenv("LANG")) ||
|
(val = getenv("LANG")) && *val ||
|
||||||
(val = "C.UTF-8");
|
(val = "C.UTF-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue