about summary refs log tree commit diff
path: root/elf/dl-deps.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-06-26 18:01:25 +0000
committerUlrich Drepper <drepper@redhat.com>1999-06-26 18:01:25 +0000
commitee0f7bd6d4d59ed45ae95cff7b536b2a3fd1fa27 (patch)
tree5ad88b14d989ea78b9f79d9c028f0e4c800a2d99 /elf/dl-deps.c
parent50e3b3976077b529413aa52ca8dcb4746f4f8c9c (diff)
downloadglibc-ee0f7bd6d4d59ed45ae95cff7b536b2a3fd1fa27.tar.gz
glibc-ee0f7bd6d4d59ed45ae95cff7b536b2a3fd1fa27.tar.xz
glibc-ee0f7bd6d4d59ed45ae95cff7b536b2a3fd1fa27.zip
(_dl_map_object_deps): When looking for the next occurence of the aux object start with the current list entry, not the new one. Adjust tail pointer in the unique list. Explain how the meaning of the variables changes.
Diffstat (limited to 'elf/dl-deps.c')
-rw-r--r--elf/dl-deps.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index 56f91f6dd0..b981d490df 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -304,7 +304,10 @@ _dl_map_object_deps (struct link_map *map,
 		/* Allocate new entry.  This always has to be done.  */
 		newp = alloca (sizeof (struct list));
 
-		/* Copy the content of the current entry over.  */
+		/* We want to insert the new map before the current one,
+		   but we have no back links.  So we copy the contents of
+		   the current entry over.  Note that ORIG and NEWP now
+		   have switched their meanings.  */
 		orig->dup = memcpy (newp, orig, sizeof (*newp));
 
 		/* Initialize new entry.  */
@@ -333,7 +336,7 @@ _dl_map_object_deps (struct link_map *map,
 		       _dl_map_object.  */
 		    --args.aux->l_opencount;
 
-		    for (late = orig; late->unique; late = late->unique)
+		    for (late = newp; late->unique; late = late->unique)
 		      if (late->unique->map == args.aux)
 			break;
 
@@ -344,10 +347,13 @@ _dl_map_object_deps (struct link_map *map,
 			   move it to this earlier position.  */
 			orig->unique = newp;
 
-			/* Now remove the later entry from the unique list.  */
+			/* Now remove the later entry from the unique list
+			   and adjust the tail pointer.  */
+			if (utail == late->unique)
+			  utail = late;
 			late->unique = late->unique->unique;
 
-			/* We must move the earlier in the chain.  */
+			/* We must move the object earlier in the chain.  */
 			if (args.aux->l_prev)
 			  args.aux->l_prev->l_next = args.aux->l_next;
 			if (args.aux->l_next)