From 6ca1cf208e0cb0af2153e9d559592730d5acb74c Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 23 Jan 2015 13:59:14 +0100 Subject: [PATCH] uwrap: Fix the handle loop for older gcc versions. Signed-off-by: Andreas Schneider Reviewed-by: Michael Adam --- lib/uid_wrapper/uid_wrapper.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/uid_wrapper/uid_wrapper.c b/lib/uid_wrapper/uid_wrapper.c index 2181767246e..c1dc56b7749 100644 --- a/lib/uid_wrapper/uid_wrapper.c +++ b/lib/uid_wrapper/uid_wrapper.c @@ -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;