summaryrefslogtreecommitdiff
path: root/locale
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2014-11-17 22:00:58 -0200
committerAlexandre Oliva <aoliva@redhat.com>2015-02-26 02:16:51 -0300
commit0d822a016b631aef409df5805f58962fe5bbcdc5 (patch)
treefa1265412059d2b5f06ed1de2f5637e346a90866 /locale
parentca681b7b7b79bea3af62fe709df6594f3f5457e6 (diff)
BZ #15969: search locale archive again after alias expansion
If a locale alias is defined in locale.alias but not in an archive, and the referenced locale is only present in the archive, setlocale will fail if given the alias name. This is unintuitive. This patch fixes it, arranging for the locale archive to be searched again after alias expansion. for ChangeLog [BZ #15969] * locale/findlocale.c (_nl_find_locale): Retry archive search after alias expansion.
Diffstat (limited to 'locale')
-rw-r--r--locale/findlocale.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/locale/findlocale.c b/locale/findlocale.c
index ab879d7775..360f58b904 100644
--- a/locale/findlocale.c
+++ b/locale/findlocale.c
@@ -156,15 +156,26 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
if (__glibc_likely (data != NULL))
return data;
+ /* Nothing in the archive with the given name. Expanding it as
+ an alias and retry. */
+ loc_name = (char *) _nl_expand_alias (*name);
+ if (loc_name != NULL)
+ {
+ data = _nl_load_locale_from_archive (category, &loc_name);
+ if (__builtin_expect (data != NULL, 1))
+ return data;
+ }
+
/* Nothing in the archive. Set the default path to search below. */
locale_path = _nl_default_locale_path;
locale_path_len = sizeof _nl_default_locale_path;
}
+ else
+ /* We really have to load some data. First see whether the name is
+ an alias. Please note that this makes it impossible to have "C"
+ or "POSIX" as aliases. */
+ loc_name = (char *) _nl_expand_alias (*name);
- /* We really have to load some data. First see whether the name is
- an alias. Please note that this makes it impossible to have "C"
- or "POSIX" as aliases. */
- loc_name = (char *) _nl_expand_alias (*name);
if (loc_name == NULL)
/* It is no alias. */
loc_name = (char *) *name;