src/solaris/back/linker_md.c

Print this page
rev 6641 : [mq]: PrivateTransportTest

@@ -58,26 +58,31 @@
                            const char* pname, const char* fname) {
     // Based on os_solaris.cpp
 
     char *path_sep = PATH_SEPARATOR;
     char *pathname = (char *)pname;
+    *buffer = '\0';
     while (strlen(pathname) > 0) {
         char *p = strchr(pathname, *path_sep);
         if (p == NULL) {
             p = pathname + strlen(pathname);
         }
         /* check for NULL path */
         if (p == pathname) {
             continue;
         }
-        (void)snprintf(buffer, buflen, "%.*s/lib%s." LIB_SUFFIX, (p - pathname),
+        (void)snprintf(buffer, buflen, "%.*s/lib%s." LIB_SUFFIX, (int)(p - pathname),
                        pathname, fname);
 
         if (access(buffer, F_OK) == 0) {
             break;
         }
+        if (*p == '\0') {
+            pathname = p;
+        } else {
         pathname = p + 1;
+        }
         *buffer = '\0';
     }
 }
 
 /*