about summary refs log tree commit diff
path: root/elf/dl-close.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-01-21 14:17:43 +0000
committerUlrich Drepper <drepper@redhat.com>1999-01-21 14:17:43 +0000
commit50b65db1ee9a87be6ead950e7cffa4c223e689fd (patch)
tree28ecfe4141d27f096b12cd3174bbbd5c0b9c3d79 /elf/dl-close.c
parent1d28e93cabf235de32a594d7b770551a34be0e75 (diff)
downloadglibc-50b65db1ee9a87be6ead950e7cffa4c223e689fd.tar.gz
glibc-50b65db1ee9a87be6ead950e7cffa4c223e689fd.tar.xz
glibc-50b65db1ee9a87be6ead950e7cffa4c223e689fd.zip
Update.
1999-01-21  Ulrich Drepper  <drepper@cygnus.com>

	* elf/dl-close.c: Rewrite the way adding to the global scope works
	to handle error cases better than the last change.
	The l_global flag is now only set when the object is actually
	counted in the global scope list.
	* elf/dl-deps.c: Likewise.
	* elf/dl-open.c: Likewise.
Diffstat (limited to 'elf/dl-close.c')
-rw-r--r--elf/dl-close.c35
1 files changed, 7 insertions, 28 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index a56c14400c..d7a61c4535 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -106,36 +106,15 @@ _dl_close (struct link_map *map)
 	      int cnt = _dl_main_searchlist->r_nlist;
 
 	      do
-		if (--cnt < 0)
-		  break;
+		--cnt;
 	      while (_dl_main_searchlist->r_list[cnt] != imap);
 
-	      if (cnt >= 0)
-		{
-		  /* The object was already correctly registered.  */
-		  while (++cnt < _dl_main_searchlist->r_nlist)
-		    _dl_main_searchlist->r_list[cnt - 1]
-		      = _dl_main_searchlist->r_list[cnt];
-
-		  --_dl_main_searchlist->r_nlist;
-		}
-	      else
-		{
-		  /* This can happen if loading was interrupted by something
-		     like a missing symbol in the newly loaded objects.  In
-		     this case the object is already marked as global but
-		     `r_nlist' does not count it in.  The pointer is in the
-		     `r_list' array so we keep searching in the other
-		     direction.  */
-		  cnt = _dl_main_searchlist->r_nlist;
-		  while (_dl_main_searchlist->r_list[cnt] != imap)
-		    {
-		      ++cnt;
-		      /* Note that if _dl_global_scope_alloc is zero we
-			 should never come here in the first place.  */
-		      assert (cnt < _dl_global_scope_alloc);
-		    }
-		}
+	      /* The object was already correctly registered.  */
+	      while (++cnt < _dl_main_searchlist->r_nlist)
+		_dl_main_searchlist->r_list[cnt - 1]
+		  = _dl_main_searchlist->r_list[cnt];
+
+	      --_dl_main_searchlist->r_nlist;
 	    }
 
 	  /* We can unmap all the maps at once.  We determined the