about summary refs log tree commit diff
path: root/elf/neededtest.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-10-23 22:58:40 +0000
committerUlrich Drepper <drepper@redhat.com>2000-10-23 22:58:40 +0000
commit9807e5408bf1d7f879216f0000c1f220beb89d93 (patch)
tree81f1eae57ddb0e46faeab5608ac95801d2c9ad41 /elf/neededtest.c
parentf92338be6ead8e01060343e9a678ddccf2b5a139 (diff)
downloadglibc-9807e5408bf1d7f879216f0000c1f220beb89d93.tar.gz
glibc-9807e5408bf1d7f879216f0000c1f220beb89d93.tar.xz
glibc-9807e5408bf1d7f879216f0000c1f220beb89d93.zip
Update.
	* elf/unload.c: Generate more debugging output.

	* elf/neededtest.c: Make it more complicated.
	* elf/neededtest2.c: New file.
	* elf/Makefile: Add rules to build and run neededtest2.
Diffstat (limited to 'elf/neededtest.c')
-rw-r--r--elf/neededtest.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/elf/neededtest.c b/elf/neededtest.c
index 98f69a3185..a33d243651 100644
--- a/elf/neededtest.c
+++ b/elf/neededtest.c
@@ -64,7 +64,7 @@ check_loaded_objects (const char **loaded)
 int
 main (void)
 {
-  void *obj2;
+  void *obj2[2];
   void *obj3;
   const char *loaded[] = { NULL, NULL, NULL, NULL };
   int errors = 0;
@@ -84,7 +84,16 @@ main (void)
   loaded[2] = "neededobj3.so";
   errors += check_loaded_objects (loaded);
   printf ("Now loading shared object neededobj2.so\n");
-  obj2 = dlopen ("neededobj2.so", RTLD_LAZY);
+  obj2[0] = dlopen ("neededobj2.so", RTLD_LAZY);
+  if (obj2 == NULL)
+    {
+      printf ("%s\n", dlerror ());
+      exit (1);
+    }
+  printf ("After loading neededobj2.so once\n");
+  errors += check_loaded_objects (loaded);
+  printf ("And loading shared object neededobj2.so again\n");
+  obj2[1] = dlopen ("neededobj2.so", RTLD_LAZY);
   if (obj2 == NULL)
     {
       printf ("%s\n", dlerror ());
@@ -92,12 +101,17 @@ main (void)
     }
   printf ("Again, this is what is in memory\n");
   errors += check_loaded_objects (loaded);
-  printf ("Closing neededobj2.so\n");
-  dlclose (obj2);
+  printf ("Closing neededobj2.so for the first time\n");
+  dlclose (obj2[0]);
   errors += check_loaded_objects (loaded);
   printf ("Closing neededobj3.so\n");
   dlclose (obj3);
+  loaded[2] = NULL;
+  errors += check_loaded_objects (loaded);
+  printf ("Closing neededobj2.so for the second time\n");
+  dlclose (obj2[1]);
   loaded[0] = NULL;
+  loaded[1] = NULL;
   errors += check_loaded_objects (loaded);
   if (errors != 0)
     printf ("%d errors found\n", errors);