]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(_dl_open): Don't put the shared object on the global scope list
authorUlrich Drepper <drepper@redhat.com>
Wed, 7 Oct 1998 18:24:29 +0000 (18:24 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 7 Oct 1998 18:24:29 +0000 (18:24 +0000)
twice.

elf/dl-open.c

index 1a82c87e41986d9f947b67804fa793f5d8c81e52..2635cc7b3a2e8017aaa9245ed6b2a0eb1835bd61 100644 (file)
@@ -113,11 +113,23 @@ _dl_open (const char *file, int mode)
              _dl_close (new);
              _dl_signal_error (ENOMEM, file, "cannot extend global scope");
            }
-         _dl_global_scope[2] = _dl_default_scope[2];
-         _dl_global_scope[3] = new;
-         _dl_global_scope[4] = NULL;
-         _dl_global_scope[5] = NULL;
-         _dl_global_scope_end = &_dl_global_scope [4];
+
+         if (_dl_default_scope[2] == new)
+           {
+             /* This happens when loading in static binaries.  */
+             _dl_global_scope[2] = new;
+             _dl_global_scope[3] = NULL;
+             _dl_global_scope[4] = NULL;
+             _dl_global_scope_end = &_dl_global_scope[3];
+           }
+         else
+           {
+             _dl_global_scope[2] = _dl_default_scope[2];
+             _dl_global_scope[3] = new;
+             _dl_global_scope[4] = NULL;
+             _dl_global_scope[5] = NULL;
+             _dl_global_scope_end = &_dl_global_scope[4];
+           }
        }
       else
        {