swrap: Fall back to RTLD_NEXT if we can't find libc.
authorAndreas Schneider <asn@samba.org>
Thu, 8 May 2014 12:07:16 +0000 (14:07 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 9 May 2014 07:03:33 +0000 (09:03 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10572

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/socket_wrapper/socket_wrapper.c

index 95c5c556935a89e4a008a1f53114c67f5d1cd251..95643aa7bd108e67b052aa6348189176861fa291 100644 (file)
@@ -393,10 +393,6 @@ static void *swrap_load_lib_handle(enum swrap_lib lib)
        void *handle = NULL;
        int i;
 
-#ifdef HAVE_APPLE
-       return RTLD_NEXT;
-#endif
-
 #ifdef RTLD_DEEPBIND
        flags |= RTLD_DEEPBIND;
 #endif
@@ -436,10 +432,14 @@ static void *swrap_load_lib_handle(enum swrap_lib lib)
        }
 
        if (handle == NULL) {
+#ifdef RTLD_NEXT
+               handle = swrap.libc_handle = swrap.libsocket_handle = RTLD_NEXT;
+#else
                SWRAP_LOG(SWRAP_LOG_ERROR,
                          "Failed to dlopen library: %s\n",
                          dlerror());
                exit(-1);
+#endif
        }
 
        return handle;