about summary refs log tree commit diff
path: root/elf/rtld.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 0736218536..58676924e5 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -310,6 +310,24 @@ of this helper program; chances are you did not intend to run this program.\n",
   preloads = NULL;
   npreloads = 0;
 
+  if (! __libc_enable_secure)
+    {
+      const char *preloadlist = getenv ("LD_PRELOAD");
+      if (preloadlist)
+	{
+	  /* The LD_PRELOAD environment variable gives a colon-separated
+	     list of libraries that are loaded before the executable's
+	     dependencies and prepended to the global scope list.  */
+	  char *list = strdupa (preloadlist);
+	  char *p;
+	  while ((p = strsep (&list, ":")) != NULL)
+	    {
+	      (void) _dl_map_object (NULL, p, lt_library);
+	      ++npreloads;
+	    }
+	}
+    }
+
   /* Read the contents of the file.  */
   file = _dl_sysdep_read_whole_file ("/etc/ld.so.preload", &file_size,
 				     PROT_READ | PROT_WRITE);
@@ -375,24 +393,6 @@ of this helper program; chances are you did not intend to run this program.\n",
       __munmap (file, file_size);
     }
 
-  if (! __libc_enable_secure)
-    {
-      const char *preloadlist = getenv ("LD_PRELOAD");
-      if (preloadlist)
-	{
-	  /* The LD_PRELOAD environment variable gives a colon-separated
-	     list of libraries that are loaded before the executable's
-	     dependencies and prepended to the global scope list.  */
-	  char *list = strdupa (preloadlist);
-	  char *p;
-	  while ((p = strsep (&list, ":")) != NULL)
-	    {
-	      (void) _dl_map_object (NULL, p, lt_library);
-	      ++npreloads;
-	    }
-	}
-    }
-
   if (npreloads != 0)
     {
       /* Set up PRELOADS with a vector of the preloaded libraries.  */