Fix endless loop with invalid /etc/shells file.
[glibc.git] / elf / tst-tls18.c
blob96b8e6bf7b95f78bb9595926263ea63fb6e5261a
1 #include <dlfcn.h>
2 #include <stdio.h>
4 static int
5 do_test (void)
7 char modname[sizeof "tst-tlsmod18aXX.so"];
8 void *h[20];
9 for (int i = 0; i < 20; i++)
11 snprintf (modname, sizeof modname, "tst-tlsmod18a%d.so", i);
12 h[i] = dlopen (modname, RTLD_LAZY);
13 if (h[i] == NULL)
15 printf ("unexpectedly failed to open %s", modname);
16 exit (1);
20 for (int i = 0; i < 20; i++)
22 int (*fp) (void) = (int (*) (void)) dlsym (h[i], "test");
23 if (fp == NULL)
25 printf ("cannot find test in tst-tlsmod18a%d.so", i);
26 exit (1);
29 if (fp ())
30 exit (1);
33 return 0;
36 #define TEST_FUNCTION do_test ()
37 #include "../test-skeleton.c"