diff options
author | Andreas Schneider <asn@samba.org> | 2015-02-23 17:15:12 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2015-02-23 20:02:51 +0100 |
commit | 8dcc02f89b48ab07a6a6bc8fa53870f352c766e9 (patch) | |
tree | 3fbfbf855c29a723bb09efb1e0f00d6d2ceec117 /lib | |
parent | 6e5debf33bfb28ec0135a19f9cfb48b39d17fc83 (diff) | |
download | samba-8dcc02f89b48ab07a6a6bc8fa53870f352c766e9.tar.gz |
swrap: Fix the loop for older gcc versions.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/socket_wrapper/socket_wrapper.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/socket_wrapper/socket_wrapper.c b/lib/socket_wrapper/socket_wrapper.c index d5c343d024d..b30303f3192 100644 --- a/lib/socket_wrapper/socket_wrapper.c +++ b/lib/socket_wrapper/socket_wrapper.c @@ -452,11 +452,14 @@ static void *swrap_load_lib_handle(enum swrap_lib lib) #ifdef HAVE_LIBSOCKET handle = swrap.libsocket_handle; if (handle == NULL) { - for (handle = NULL, i = 10; handle == NULL && i >= 0; i--) { + for (i = 10; i >= 0; i--) { char soname[256] = {0}; snprintf(soname, sizeof(soname), "libsocket.so.%d", i); handle = dlopen(soname, flags); + if (handle != NULL) { + break; + } } swrap.libsocket_handle = handle; @@ -474,11 +477,14 @@ static void *swrap_load_lib_handle(enum swrap_lib lib) } #endif if (handle == NULL) { - for (handle = NULL, i = 10; handle == NULL && i >= 0; i--) { + for (i = 10; i >= 0; i--) { char soname[256] = {0}; snprintf(soname, sizeof(soname), "libc.so.%d", i); handle = dlopen(soname, flags); + if (handle != NULL) { + break; + } } swrap.libc_handle = handle; |