diff options
| author | Maciej Mrozowski (reavertm) <reavertm@poczta.fm> | 2009-12-18 04:13:20 +0100 |
|---|---|---|
| committer | Maciej Mrozowski (reavertm) <reavertm@poczta.fm> | 2009-12-18 04:13:20 +0100 |
| commit | e339e3cf1bc3569de395ce63060062bd9573739a (patch) | |
| tree | a33331a320cbafdcbb29ab125f2739acc8e56852 /Documentation/maintainers/try_dlopen.c | |
| parent | ffb83c2614a714a85b0f5f1de0f282e422f6ce16 (diff) | |
| download | kde-e339e3cf1bc3569de395ce63060062bd9573739a.tar.gz kde-e339e3cf1bc3569de395ce63060062bd9573739a.tar.bz2 kde-e339e3cf1bc3569de395ce63060062bd9573739a.zip | |
[Documentation/maintainers/dynlink-scanner.sh] Try to dlopen shared libs to detect unresolved symbols.
Diffstat (limited to 'Documentation/maintainers/try_dlopen.c')
| -rw-r--r-- | Documentation/maintainers/try_dlopen.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Documentation/maintainers/try_dlopen.c b/Documentation/maintainers/try_dlopen.c new file mode 100644 index 00000000000..7ff695810b9 --- /dev/null +++ b/Documentation/maintainers/try_dlopen.c @@ -0,0 +1,23 @@ +#include <stdio.h> +#include <dlfcn.h> + +/** + * Attempts to load shared libraries + * @param argc + * @param argv files to check (pass only shared libs) + * @return 0 - all shared libs loaded, 1 - error occured (invalid or broken files passed) + */ +int main(int argc, char* argv[]) +{ + int i; + for (i = 1; i < argc; ++i) { + void* handle = dlopen(argv[i], RTLD_NOW); + if (!handle) { + fprintf(stderr, "%s\n", dlerror()); + return 1; + } else { + dlclose(handle); + } + } + return 0; +} |
