Fallback to $LANG if $LC_ALL isn't set.
authorJonathan Pryor <jonpryor@vt.edu>
Mon, 7 Oct 2013 16:27:30 +0000 (12:27 -0400)
committerJonathan Pryor <jonpryor@vt.edu>
Mon, 7 Oct 2013 16:31:06 +0000 (12:31 -0400)
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=15214

This is a regression introduced in be532638.

Xamarin.Android assumes that the $LANG environment variable can be
used to control System.Globalization.CultureInfo.CurrentCulture,
setting LANG based on the current Java locale.

This was broken in be532638 because $LANG was no longer being checked
to determine the default locale, as $LC_ALL was not set.

Fix the fallback logic so that $LANG is checked when $LC_ALL is not.

mono/metadata/locales.c

index 513e3150269c1dbdd4d4ced4f167d5d94e4ec138..7286c3c249863dd6043a70b282dd4b715b79f4b3 100644 (file)
@@ -402,7 +402,7 @@ get_posix_locale (void)
        const char *locale;
 
        locale = g_getenv ("LC_ALL");
-       if (locale != NULL){
+       if (locale == NULL) {
                locale = g_getenv ("LANG");
                if (locale == NULL)
                        locale = setlocale (LC_ALL, NULL);