about summary refs log tree commit diff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 2ca108ef69..d8b3a56d0d 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1760,6 +1760,11 @@ open_path (const char *name, size_t namelen, int preloaded,
   const char *current_what = NULL;
   int any = 0;
 
+  if (__builtin_expect (dirs == NULL, 0))
+    /* We're called before _dl_init_paths when loading the main executable
+       given on the command line when rtld is run directly.  */
+    return -1;
+
   buf = alloca (max_dirnamelen + max_capstrlen + namelen);
   do
     {