summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPino Toscano <toscano.pino@tiscali.it>2014-05-08 13:37:02 +0200
committerAndreas Schneider <asn@samba.org>2014-05-08 16:00:10 +0200
commit0fa56909442c3cfea6a697681ea0e89ba5a0aa0f (patch)
tree39b3dd3777af3db8de637e0fbb6d2de86eb4e984 /src
parent3d70059d5465e8ae0a3149265ea7c04a78e480d2 (diff)
downloadsocket_wrapper-0fa56909442c3cfea6a697681ea0e89ba5a0aa0f.tar.gz
socket_wrapper-0fa56909442c3cfea6a697681ea0e89ba5a0aa0f.tar.xz
socket_wrapper-0fa56909442c3cfea6a697681ea0e89ba5a0aa0f.zip
swrap: use LIBC_SO from GNU libc, if available
Look for gnu/lib-names.h and use the LIBC_SO define to dlopen libc, so the right library is loaded without manually searching for libc.so.N. Signed-off-by: Pino Toscano <toscano.pino@tiscali.it> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'src')
-rw-r--r--src/socket_wrapper.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index 95643aa..38f7a44 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -73,6 +73,9 @@
#include <stdarg.h>
#include <stdbool.h>
#include <unistd.h>
+#ifdef HAVE_GNU_LIB_NAMES_H
+#include <gnu/lib-names.h>
+#endif
enum swrap_dbglvl_e {
SWRAP_LOG_ERROR = 0,
@@ -418,6 +421,11 @@ static void *swrap_load_lib_handle(enum swrap_lib lib)
/* FALL TROUGH */
case SWRAP_LIBC:
handle = swrap.libc_handle;
+#ifdef LIBC_SO
+ if (handle == NULL) {
+ handle = dlopen(LIBC_SO, flags);
+ }
+#endif
if (handle == NULL) {
for (handle = NULL, i = 10; handle == NULL && i >= 0; i--) {
char soname[256] = {0};