about summary refs log tree commit diff
path: root/locale/setlocale.c
diff options
context:
space:
mode:
Diffstat (limited to 'locale/setlocale.c')
-rw-r--r--locale/setlocale.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/locale/setlocale.c b/locale/setlocale.c
index 50963d152c..46af339eae 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -247,18 +247,22 @@ setlocale (int category, const char *locale)
   /* We perhaps really have to load some data.  So we determine the
      path in which to look for the data now.  The environment variable
      `LOCPATH' must only be used when the binary has no SUID or SGID
-     bit set.  */
+     bit set.  If using the default path, we tell _nl_find_locale
+     by passing null and it can check the canonical locale archive.  */
   locale_path = NULL;
   locale_path_len = 0;
 
   locpath_var = getenv ("LOCPATH");
   if (locpath_var != NULL && locpath_var[0] != '\0')
-    if (__argz_create_sep (locpath_var, ':',
-			   &locale_path, &locale_path_len) != 0)
-      return NULL;
+    {
+      if (__argz_create_sep (locpath_var, ':',
+			     &locale_path, &locale_path_len) != 0)
+	return NULL;
 
-  if (__argz_add_sep (&locale_path, &locale_path_len, LOCALEDIR, ':') != 0)
-    return NULL;
+      if (__argz_add_sep (&locale_path, &locale_path_len,
+			  _nl_default_locale_path, ':') != 0)
+	return NULL;
+    }
 
   if (category == LC_ALL)
     {