about summary refs log tree commit diff
path: root/sysdeps/generic/dl-tls.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-01-10 11:10:54 +0000
committerUlrich Drepper <drepper@redhat.com>2005-01-10 11:10:54 +0000
commit73102f5002272e82b083fa912068a3777f3e0f2e (patch)
tree50cf72df0e7e49e3054d7ba5ce11fb9c8b3f2c2a /sysdeps/generic/dl-tls.c
parent9fbdeb410d7d7e7383b20b71da4dd4bd481a8808 (diff)
downloadglibc-73102f5002272e82b083fa912068a3777f3e0f2e.tar.gz
glibc-73102f5002272e82b083fa912068a3777f3e0f2e.tar.xz
glibc-73102f5002272e82b083fa912068a3777f3e0f2e.zip
Update.
2005-01-10  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/generic/dl-tls.c (_dl_next_tls_modid): Fix assertion and
	recognition of last entry.
Diffstat (limited to 'sysdeps/generic/dl-tls.c')
-rw-r--r--sysdeps/generic/dl-tls.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sysdeps/generic/dl-tls.c b/sysdeps/generic/dl-tls.c
index 10b7f2c65a..099742ceff 100644
--- a/sysdeps/generic/dl-tls.c
+++ b/sysdeps/generic/dl-tls.c
@@ -67,7 +67,10 @@ _dl_next_tls_modid (void)
       /* Note that this branch will never be executed during program
 	 start since there are no gaps at that time.  Therefore it
 	 does not matter that the dl_tls_dtv_slotinfo is not allocated
-	 yet when the function is called for the first times.  */
+	 yet when the function is called for the first times.
+
+	 NB: the offset +1 is due to the fact that DTV[0] is used
+	 for something else.  */
       result = GL(dl_tls_static_nelem) + 1;
       /* If the following would not be true we mustn't have assumed
 	 there is a gap.  */
@@ -90,11 +93,11 @@ _dl_next_tls_modid (void)
 	}
       while ((runp = runp->next) != NULL);
 
-      if (result >= GL(dl_tls_max_dtv_idx))
+      if (result > GL(dl_tls_max_dtv_idx))
 	{
 	  /* The new index must indeed be exactly one higher than the
 	     previous high.  */
-	  assert (result == GL(dl_tls_max_dtv_idx));
+	  assert (result == GL(dl_tls_max_dtv_idx) + 1);
 
 	  /* There is no gap anymore.  */
 	  GL(dl_tls_dtv_gaps) = false;