summaryrefslogtreecommitdiff
path: root/Documentation/maintainers/try_dlopen.c
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/maintainers/try_dlopen.c')
-rw-r--r--Documentation/maintainers/try_dlopen.c23
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;
+}