loader: Fix infinite loop on layer library scan if dlopen fails
authorJon Ashburn <jon@lunarg.com>
Fri, 16 Jan 2015 15:46:38 +0000 (08:46 -0700)
committerCourtney Goeltzenleuchter <courtney@LunarG.com>
Thu, 5 Feb 2015 00:58:07 +0000 (17:58 -0700)
loader/loader.c

index 8a0b3eb9f59b28cca92171bc33889f2f236dad65..548a9aa3a671b01f51618c3793479475d9c3dd96 100644 (file)
@@ -435,8 +435,10 @@ static void layer_lib_scan(const char * libInPaths)
              if (!strncmp(dent->d_name, "libXGLLayer", strlen("libXGLLayer"))) {
                 void * handle;
                 snprintf(temp_str, sizeof(temp_str), "%s/%s",p,dent->d_name);
-                if ((handle = dlopen(temp_str, RTLD_LAZY)) == NULL)
+                if ((handle = dlopen(temp_str, RTLD_LAZY)) == NULL) {
+                    dent = readdir(curdir);
                     continue;
+                }
                 if (loader.scanned_layer_count == MAX_LAYER_LIBRARIES) {
                     loader_log(XGL_DBG_MSG_ERROR, 0, "%s ignored: max layer libraries exceed", temp_str);
                     break;