uwrap: Fix the handle loop for older gcc versions.
authorAndreas Schneider <asn@samba.org>
Fri, 23 Jan 2015 12:59:14 +0000 (13:59 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 28 Jan 2015 16:17:07 +0000 (17:17 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
lib/uid_wrapper/uid_wrapper.c

index 2181767246ebe38b6582a36986108f25b6ac1c7c..c1dc56b77494db15e303d25accb6d40c159adbea 100644 (file)
@@ -271,11 +271,14 @@ static void *uwrap_load_lib_handle(enum uwrap_lib lib)
        case UWRAP_LIBC:
                handle = uwrap.libc.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), "libc.so.%d", i);
                                handle = dlopen(soname, flags);
+                               if (handle != NULL) {
+                                       break;
+                               }
                        }
 
                        uwrap.libc.handle = handle;