From: Ulrich Drepper Date: Wed, 7 Oct 1998 18:24:29 +0000 (+0000) Subject: (_dl_open): Don't put the shared object on the global scope list X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ce85971edd23c391c103094706e786b71be61e9;p=thirdparty%2Fglibc.git (_dl_open): Don't put the shared object on the global scope list twice. --- diff --git a/elf/dl-open.c b/elf/dl-open.c index 1a82c87e419..2635cc7b3a2 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -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 {