Fix endless loop with invalid /etc/shells file.
[glibc.git] / elf / tst-tlsmod2.c
blob981923313c5454f01b0fdba0eb1f0d1d2466b1f3
1 #include <stdio.h>
3 #include <tls.h>
5 #include "tls-macros.h"
8 COMMON_INT_DEF(foo);
11 int
12 in_dso (int n, int *caller_foop)
14 int *foop;
15 int result = 0;
17 puts ("foo"); /* Make sure PLT is used before macros. */
18 asm ("" ::: "memory");
20 foop = TLS_GD (foo);
22 if (caller_foop != NULL && foop != caller_foop)
24 printf ("callers address of foo differs: %p vs %p\n", caller_foop, foop);
25 result = 1;
27 else if (*foop != n)
29 printf ("foo != %d\n", n);
30 result = 1;
33 *foop = 16;
35 return result;