summaryrefslogtreecommitdiff
path: root/regress/libexec/ld.so/dependencies/order1/prog1/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'regress/libexec/ld.so/dependencies/order1/prog1/main.c')
-rw-r--r--regress/libexec/ld.so/dependencies/order1/prog1/main.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/regress/libexec/ld.so/dependencies/order1/prog1/main.c b/regress/libexec/ld.so/dependencies/order1/prog1/main.c
new file mode 100644
index 00000000000..860e1a39eae
--- /dev/null
+++ b/regress/libexec/ld.so/dependencies/order1/prog1/main.c
@@ -0,0 +1,42 @@
+#include <dlfcn.h>
+#include <stdio.h>
+
+int
+main()
+{
+ void *libaa, *libbb;
+ int flag = RTLD_NOW;
+
+ if ((libaa = dlopen("libaa.so", flag)) == NULL) {
+ printf("dlopen(\"libaa.so\", %d) FAILED\n", flag);
+ return 1;
+ }
+
+ if ((libbb = dlopen("libbb.so", flag)) == NULL) {
+ printf("dlopen(\"libbb.so\", %d) FAILED\n", flag);
+ return 1;
+ }
+
+ if (dlclose(libbb)) {
+ printf("dlclose(libbb) FAILED\n%s\n", dlerror());
+ return 1;
+ }
+
+ if ((libbb = dlopen("libbb.so", flag)) == NULL) {
+ printf("dlopen(\"libbb.so\", %d) FAILED\n", flag);
+ return 1;
+ }
+
+ if (dlclose(libbb)) {
+ printf("dlclose(libbb) FAILED\n%s\n", dlerror());
+ return 1;
+ }
+
+ if (dlclose(libaa)) {
+ printf("dlclose(libaa) FAILED\n%s\n", dlerror());
+ return 1;
+ }
+
+ return 0;
+}
+