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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 4, 2012 at 5:51 PM,  <gzjjgod@xxxxxxxxx> wrote:
> From: Jiang Jiang <gzjjgod@xxxxxxxxx>
>
> 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.

Right.

> 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

Though it would be sufficient to just check if langs[0] is 0 or not.

Thanks anyway.

-- 
Akira TAGOH
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig



[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux