uwrap: Fall back to RTLD_NEXT if we can't find libc.
authorAndreas Schneider <asn@samba.org>
Thu, 31 Jul 2014 08:13:40 +0000 (10:13 +0200)
committerMichael Adam <obnox@samba.org>
Thu, 31 Jul 2014 16:49:47 +0000 (18:49 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
lib/uid_wrapper/uid_wrapper.c

index b77aa023ece86f9240bfa6808ef22ed0d193d099..e9c7d5a94ea191305388f02543998e8d66396382 100644 (file)
@@ -194,10 +194,6 @@ static void *uwrap_load_lib_handle(enum uwrap_lib lib)
        void *handle = NULL;
        int i;
 
-#ifdef HAVE_APPLE
-       return RTLD_NEXT;
-#endif
-
 #ifdef RTLD_DEEPBIND
        flags |= RTLD_DEEPBIND;
 #endif
@@ -223,10 +219,14 @@ static void *uwrap_load_lib_handle(enum uwrap_lib lib)
        }
 
        if (handle == NULL) {
+#ifdef RTLD_NEXT
+               handle = uwrap.libc.handle = RTLD_NEXT;
+#else
                fprintf(stderr,
                        "Failed to dlopen library: %s\n",
                        dlerror());
                exit(-1);
+#endif
        }
 
        return handle;