diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-01-20 20:01:17 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-01-20 20:01:17 +0000 |
commit | 1e2623127469890c7912d12a8ba5bc70d068eb18 (patch) | |
tree | f3e9b75f2cd829b6819c2c7e825c6c97366697ad /elf/loadfail.c | |
parent | ad11b5a745d0aeee42ead08f6cadfe4dcc84ad82 (diff) | |
download | glibc-1e2623127469890c7912d12a8ba5bc70d068eb18.tar.gz |
Update.
* elf/Makefile (tests): Add loadfail.
Add rules to build failobj.so.
* elf/loadfail.c: New file. Test of failing to load object with
RTLD_GLOBAL set.
* elf/failobj.c: New file. Object which will fail to load.
Diffstat (limited to 'elf/loadfail.c')
-rw-r--r-- | elf/loadfail.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/elf/loadfail.c b/elf/loadfail.c new file mode 100644 index 0000000000..60deb7737b --- /dev/null +++ b/elf/loadfail.c @@ -0,0 +1,30 @@ +#include <dlfcn.h> +#include <error.h> +#include <stdio.h> +#include <stdlib.h> + +int +main (void) +{ + void *h; + + if (dlopen ("testobj1.so", RTLD_GLOBAL | RTLD_NOW) == NULL + || dlopen ("testobj1.so", RTLD_GLOBAL | RTLD_NOW) == NULL + || dlopen ("testobj2.so", RTLD_GLOBAL | RTLD_NOW) == NULL + || dlopen ("testobj3.so", RTLD_GLOBAL | RTLD_NOW) == NULL + || dlopen ("testobj4.so", RTLD_GLOBAL | RTLD_NOW) == NULL + || dlopen ("testobj5.so", RTLD_GLOBAL | RTLD_NOW) == NULL) + error (EXIT_FAILURE, 0, "failed to load shared object: %s", dlerror ()); + + h = dlopen ("failobj.so", RTLD_GLOBAL | RTLD_NOW); + + printf ("h = %p, %s\n", h, h == NULL ? "ok" : "fail"); + + return h != NULL; +} + +int +foo (int a) +{ + return 10; +} |