BUG: https://bugzilla.samba.org/show_bug.cgi?id=15228
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
if (handle == NULL) {
#ifdef RTLD_NEXT
- handle = uwrap.libc.handle = RTLD_NEXT;
+ switch (lib) {
+ case UWRAP_LIBC:
+ handle = uwrap.libc.handle = RTLD_NEXT;
+ break;
+ case UWRAP_LIBPTHREAD:
+ handle = uwrap.libpthread.handle = RTLD_NEXT;
+ break;
+ }
#else
fprintf(stderr,
"Failed to dlopen library: %s\n",
dlclose(uwrap.libc.handle);
}
- if (uwrap.libpthread.handle != NULL) {
+ if (uwrap.libpthread.handle != NULL
+#ifdef RTLD_NEXT
+ && uwrap.libpthread.handle != RTLD_NEXT
+#endif
+ ) {
dlclose(uwrap.libpthread.handle);
}