diff options
author | Lopo | 2015-06-17 20:07:15 +0200 |
---|---|---|
committer | Lopo | 2015-06-17 20:07:15 +0200 |
commit | 39298255097ce674d3d593e9c75117f3d310efd2 (patch) | |
tree | f9f3d70b55558bc9aa9fce3c5f0a6845936385e9 /dlopen.c | |
download | aur-eggdrop-gseen.mod.tar.gz |
Initial import
Diffstat (limited to 'dlopen.c')
-rw-r--r-- | dlopen.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/dlopen.c b/dlopen.c new file mode 100644 index 000000000000..0cc81f9a005d --- /dev/null +++ b/dlopen.c @@ -0,0 +1,29 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <limits.h> +#include <sys/stat.h> + +/* Simple program to see if dlopen() would succeed. */ +int main(int argc, char **argv) +{ + int i; + struct stat st; + char buf[PATH_MAX]; + + for (i=1; i<argc; i++) { + if (dlopen(argv[i], RTLD_NOW)) { + fprintf(stdout, "dlopen() of '%s' succeeded.\n", argv[i]); + } + else { + snprintf(buf, sizeof (buf), "./%s", argv[i]); + if ((!stat(buf, &st)) && dlopen(buf, RTLD_NOW)) { + fprintf(stdout, "dlopen() of './%s' succeeded.\n", argv[i]); + } + else { + fprintf(stdout, "dlopen() of '%s' failed: %s\n", argv[i], dlerror()); + return 1; + } + } + } + return 0; +} |