[Fontconfig] [PATCH] Check not only existence but also emptyness of environments

gzjjgod at gmail.com gzjjgod at gmail.com
Mon Jun 4 01:51:20 PDT 2012


From: Jiang Jiang <gzjjgod at gmail.com>

Locale environment variables, especially LC_ALL, can be empty but
still set. If we don't check, FcGetDefaultLangs() will fallback to
"en" for LC_ALL="" case, even if LANG and LC_CTYPE are set.
---
 src/fcdefault.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/fcdefault.c b/src/fcdefault.c
index 674374c..400d9f5 100644
--- a/src/fcdefault.c
+++ b/src/fcdefault.c
@@ -46,11 +46,11 @@ FcGetDefaultLangs (void)
     char *langs;
 
     langs = getenv ("FC_LANG");
-    if (!langs)
+    if (!langs || !strlen(langs))
 	langs = getenv ("LC_ALL");
-    if (!langs)
+    if (!langs || !strlen(langs))
 	langs = getenv ("LC_CTYPE");
-    if (!langs)
+    if (!langs || !strlen(langs))
 	langs = getenv ("LANG");
     if (langs)
     {
-- 
1.7.4.1



More information about the Fontconfig mailing list