From: Roland McGrath Date: Wed, 16 Feb 2005 10:23:02 +0000 (+0000) Subject: 2005-01-10 Ulrich Drepper X-Git-Tag: cvs/fedora-glibc-2_3-20050216T1256~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6cf3dca07f22b441e95b1e8b950d71816330a429;p=thirdparty%2Fglibc.git 2005-01-10 Ulrich Drepper * sysdeps/generic/dl-tls.c (_dl_next_tls_modid): Fix assertion and recognition of last entry. --- diff --git a/sysdeps/generic/dl-tls.c b/sysdeps/generic/dl-tls.c index 2282dda9cc3..03a45c7c88c 100644 --- a/sysdeps/generic/dl-tls.c +++ b/sysdeps/generic/dl-tls.c @@ -65,7 +65,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. */ @@ -88,11 +91,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;