nwrap: Fall back to RTLD_NEXT if we can't find libc.
authorAndreas Schneider <asn@samba.org>
Thu, 9 Oct 2014 07:13:48 +0000 (09:13 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 9 Oct 2014 10:24:03 +0000 (12:24 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
lib/nss_wrapper/nss_wrapper.c

index a012cbd84b9431a6e3e74f42b48c3a065fbc0529..e3943ee61b57c6594e4ce944bd5833cf9da2c142 100644 (file)
@@ -562,10 +562,6 @@ static void *nwrap_load_lib_handle(enum nwrap_lib lib)
        void *handle = NULL;
        int i;
 
-#ifdef HAVE_APPLE
-       return RTLD_NEXT;
-#endif
-
 #ifdef RTLD_DEEPBIND
        flags |= RTLD_DEEPBIND;
 #endif
@@ -619,10 +615,17 @@ static void *nwrap_load_lib_handle(enum nwrap_lib lib)
        }
 
        if (handle == NULL) {
+#ifdef RTLD_NEXT
+               handle = nwrap_main_global->libc->handle
+                      = nwrap_main_global->libc->sock_handle
+                      = nwrap_main_global->libc->nsl_handle
+                      = RTLD_NEXT;
+#else
                NWRAP_LOG(NWRAP_LOG_ERROR,
                          "Failed to dlopen library: %s\n",
                          dlerror());
                exit(-1);
+#endif
        }
 
        return handle;