about summary refs log tree commit diff
path: root/elf/dl-open.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-open.c')
-rw-r--r--elf/dl-open.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 6fcfcce3ce..5710ffb40f 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -21,6 +21,7 @@
 #include <dlfcn.h>
 #include <errno.h>
 #include <libintl.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
@@ -431,7 +432,8 @@ dl_open_worker (void *a)
 
   /* Bump the generation number if necessary.  */
   if (any_tls)
-    ++GL(dl_tls_generation);
+    if (__builtin_expect (++GL(dl_tls_generation) == 0, 0))
+      __libc_fatal (gettext ("TLS generation counter wrapped!  Please send report with the 'glibcbug' script."));
 #endif
 
   /* Run the initializer functions of new objects.  */