about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-load.c2
-rw-r--r--elf/rtld.c36
2 files changed, 19 insertions, 19 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index b56303fa4a..9dfc961a2f 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -418,7 +418,7 @@ open_path (const char *name, size_t namelen,
   p = dirpath;
   if (p == NULL || *p == '\0')
     {
-      errno = ENOENT;
+      __set_errno (ENOENT);
       return -1;
     }
 
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.  */