From 697908277951dc7fb9570e17f2662d8734aab986 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 9 Oct 2014 09:13:48 +0200 Subject: [PATCH] nwrap: Fall back to RTLD_NEXT if we can't find libc. Signed-off-by: Andreas Schneider Reviewed-by: Michael Adam --- lib/nss_wrapper/nss_wrapper.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/nss_wrapper/nss_wrapper.c b/lib/nss_wrapper/nss_wrapper.c index a012cbd84b9..e3943ee61b5 100644 --- a/lib/nss_wrapper/nss_wrapper.c +++ b/lib/nss_wrapper/nss_wrapper.c @@ -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; -- 2.11.4.GIT