about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-08-21 21:02:42 +0000
committerUlrich Drepper <drepper@redhat.com>2000-08-21 21:02:42 +0000
commit70ca2a49901b398d4a1291340e3e3d51b3c7ff58 (patch)
tree49b5560831b59b2a72444b1b5c9fe1255dff3102
parent566b0f7b876748e3f477ae2db267cf99b4f14766 (diff)
downloadglibc-70ca2a49901b398d4a1291340e3e3d51b3c7ff58.tar.gz
glibc-70ca2a49901b398d4a1291340e3e3d51b3c7ff58.tar.xz
glibc-70ca2a49901b398d4a1291340e3e3d51b3c7ff58.zip
(_nl_find_locale): Move test for unusable locale name after all getenvs.
-rw-r--r--locale/findlocale.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/locale/findlocale.c b/locale/findlocale.c
index 1eac186f16..e6d229a4de 100644
--- a/locale/findlocale.c
+++ b/locale/findlocale.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
 
@@ -54,11 +54,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
   const char *revision;
   struct loaded_l10nfile *locale_file;
 
-  if ((*name)[0] == '\0'
-      /* In SUID binaries we must not allow people to access files
-	 outside the dedicated locale directories.  */
-      || (__libc_enable_secure
-	  && memchr (*name, '/', _nl_find_language (*name) - *name) != NULL))
+  if ((*name)[0] == '\0')
     {
       /* The user decides which locale to use by setting environment
 	 variables.  */
@@ -67,10 +63,13 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
 	*name = getenv (_nl_category_names[category]);
       if (*name == NULL || (*name)[0] == '\0')
 	*name = getenv ("LANG");
-      if (*name == NULL || (*name)[0] == '\0')
-	*name = (char *) _nl_C_name;
     }
 
+  if (*name == NULL || (*name)[0] == '\0'
+      || (__builtin_expect (__libc_enable_secure, 0)
+	  && memchr (*name, '/', _nl_find_language (*name) - *name) != NULL))
+    *name = (char *) _nl_C_name;
+
   if (strcmp (*name, _nl_C_name) == 0 || strcmp (*name, _nl_POSIX_name) == 0)
     {
       /* We need not load anything.  The needed data is contained in