about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-10-09 22:34:17 +0000
committerRoland McGrath <roland@gnu.org>2003-10-09 22:34:17 +0000
commitb49329d93ce6700b3cb8e6acfe5943e8cc9043a8 (patch)
treec816ee26aa10999f55daf2e570ab058a4a26041f /elf
parent943ae89d56bdaf74caee27d56689ccd9c52fed96 (diff)
downloadglibc-b49329d93ce6700b3cb8e6acfe5943e8cc9043a8.tar.gz
glibc-b49329d93ce6700b3cb8e6acfe5943e8cc9043a8.tar.xz
glibc-b49329d93ce6700b3cb8e6acfe5943e8cc9043a8.zip
2003-10-09 Roland McGrath <roland@redhat.com>
	* elf/rtld.c (dl_main): Don't set l_name for sysinfo DSO, since there
	is no file to name.
Diffstat (limited to 'elf')
-rw-r--r--elf/rtld.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 4291f18993..4f22a625ed 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1176,7 +1176,9 @@ of this helper program; chances are you did not intend to run this program.\n\
 	  l->l_map_start = (ElfW(Addr)) GL(dl_sysinfo_dso);
 
 	  /* Now that we have the info handy, use the DSO image's soname
-	     so this object can be looked up by name.  */
+	     so this object can be looked up by name.  Note that we do not
+	     set l_name here.  That field gives the file name of the DSO,
+	     and this DSO is not associated with any file.  */
 	  if (l->l_info[DT_SONAME] != NULL)
 	    {
 	      /* Work around a kernel problem.  The kernel cannot handle
@@ -1184,10 +1186,10 @@ of this helper program; chances are you did not intend to run this program.\n\
 	      const char *dsoname = ((char *) D_PTR (l, l_info[DT_STRTAB])
 				     + l->l_info[DT_SONAME]->d_un.d_val);
 	      size_t len = strlen (dsoname);
-	      l->l_name = (char *) malloc (len);
-	      if (l->l_name == NULL)
+	      char *copy = malloc (len);
+	      if (copy == NULL)
 		_dl_fatal_printf ("out of memory\n");
-	      l->l_libname->name = memcpy (l->l_name, dsoname, len);
+	      l->l_libname->name = memcpy (copy, dsoname, len);
 	    }
 	}
     }