about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-close.c5
-rw-r--r--elf/dl-open.c8
2 files changed, 7 insertions, 6 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 3d8122a375..094db533dd 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -44,9 +44,8 @@ remove_slotinfo (size_t idx, struct dtv_slotinfo_list *listp, size_t disp,
       if (listp->next == NULL)
 	{
 	  /* The index is not actually valid in the slotinfo list,
-	     because this object was closed before it was fully setup
-	     due to some error.  */
-	  assert (idx - disp == listp->len);
+	     because this object was closed before it was fully set
+	     up due to some error.  */
 	  assert (! should_be_there);
 	}
       else
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 08efe6958d..0e74996473 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -378,17 +378,19 @@ dl_open_worker (void *a)
 
 	assert (new->l_searchlist.r_list[i]->l_type == lt_loaded);
 
-	/* Find the place in the stv slotinfo list.  */
+	/* Find the place in the dtv slotinfo list.  */
 	listp = GL(dl_tls_dtv_slotinfo_list);
 	prevp = NULL;		/* Needed to shut up gcc.  */
 	do
 	  {
 	    /* Does it fit in the array of this list element?  */
-	    if (idx <= listp->len)
+	    if (idx < listp->len)
 	      break;
+	    idx -= listp->len;
 	    prevp = listp;
+	    listp = listp->next;
 	  }
-	while ((listp = listp->next) != NULL);
+	while (listp != NULL);
 
 	if (listp == NULL)
 	  {