about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-08-15 07:06:23 +0000
committerUlrich Drepper <drepper@redhat.com>2000-08-15 07:06:23 +0000
commit07a3d63e524f13dd09e14adb0ac2623f6600401d (patch)
tree7a19ce309262c7d2d7fa26ad15df1aeaa969b9f4 /elf
parentb8fd550293431d4df42b281fc868ef0ab80e822b (diff)
downloadglibc-07a3d63e524f13dd09e14adb0ac2623f6600401d.tar.gz
glibc-07a3d63e524f13dd09e14adb0ac2623f6600401d.tar.xz
glibc-07a3d63e524f13dd09e14adb0ac2623f6600401d.zip
Update.
2000-08-15  Ulrich Drepper  <drepper@redhat.com>

	* elf/multiload.c: Add mtrace call.  Call dlclose for all handles and
	free wd.
	* elf/dl-deps.c (_dl_map_object_deps): Don't allocate needed list if
	there is already one.

	* elf/dl-close.c: Pretty print.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-close.c8
-rw-r--r--elf/dl-deps.c3
-rw-r--r--elf/multiload.c26
3 files changed, 32 insertions, 5 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 99d52d02e2..6bdedd1b80 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -189,10 +189,10 @@ _dl_close (void *_map)
 	  /* Remove the searchlists.  */
 	  if (imap != map)
 	    {
-	    if (imap->l_searchlist.r_list != NULL)
-	      free (imap->l_searchlist.r_list);
-	    else if (imap->l_initfini != NULL)
-	      free (imap->l_initfini);
+	      if (imap->l_searchlist.r_list != NULL)
+		free (imap->l_searchlist.r_list);
+	      else if (imap->l_initfini != NULL)
+		free (imap->l_initfini);
 	    }
 
 	  if (imap->l_phdr_allocated)
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index 5bc048edb9..4fc2943c14 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -201,7 +201,8 @@ _dl_map_object_deps (struct link_map *map,
 
       /* Allocate a temporary record to contain the references to the
 	 dependencies of this object.  */
-      if (l->l_searchlist.r_list == NULL && l != map && l->l_ldnum > 0)
+      if (l->l_searchlist.r_list == NULL && l->l_initfini == NULL
+	  && l != map && l->l_ldnum > 0)
 	needed = (struct link_map **) alloca (l->l_ldnum
 					      * sizeof (struct link_map *));
 
diff --git a/elf/multiload.c b/elf/multiload.c
index 724c1ed562..3727d97f6a 100644
--- a/elf/multiload.c
+++ b/elf/multiload.c
@@ -1,5 +1,6 @@
 #include <dlfcn.h>
 #include <errno.h>
+#include <mcheck.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -16,6 +17,8 @@ main (void)
   char *base;
   char *buf;
 
+  mtrace ();
+
   /* Change to the binary directory.  */
   if (chdir (OBJDIR) != 0)
     {
@@ -68,6 +71,29 @@ main (void)
       exit (EXIT_FAILURE);
     }
 
+  if (dlclose (a) != 0)
+    {
+      puts ("closing `a' failed");
+      exit (EXIT_FAILURE);
+    }
+  if (dlclose (b) != 0)
+    {
+      puts ("closing `a' failed");
+      exit (EXIT_FAILURE);
+    }
+  if (dlclose (c) != 0)
+    {
+      puts ("closing `a' failed");
+      exit (EXIT_FAILURE);
+    }
+  if (dlclose (d) != 0)
+    {
+      puts ("closing `a' failed");
+      exit (EXIT_FAILURE);
+    }
+
+  free (wd);
+
   return 0;
 }