elf: Fix tst-pldd for non-default --prefix and/or --bindir (BZ#24544)
[platform/upstream/glibc.git] / elf / resolvfail.c
1 #include <dlfcn.h>
2 #include <stdio.h>
3
4 static const char obj[] = "testobj1.so";
5
6 int
7 main (void)
8 {
9   void *d = dlopen (obj, RTLD_LAZY);
10   int n;
11
12   if (d == NULL)
13     {
14       printf ("cannot load %s: %s\n", obj, dlerror ());
15       return 1;
16     }
17
18   for (n = 0; n < 10000; ++n)
19     if (dlsym (d, "does not exist") != NULL)
20       {
21         puts ("dlsym() did not fail");
22         return 1;
23       }
24     else if (dlerror () == NULL)
25       {
26         puts ("dlerror() didn't return a string");
27         return 1;
28       }
29
30   return 0;
31 }