jdk/src/windows/back/linker_md.c
changeset 16057 16a81953a291
parent 14698 9294fcf94c46
child 16726 f76b2e6bd199
--- a/jdk/src/windows/back/linker_md.c	Tue Mar 05 11:49:33 2013 -0800
+++ b/jdk/src/windows/back/linker_md.c	Tue Mar 05 19:25:35 2013 +0100
@@ -44,6 +44,7 @@
 
     char *path_sep = PATH_SEPARATOR;
     char *pathname = (char *)pname;
+    *buffer = '\0';
     while (strlen(pathname) > 0) {
         char *p = strchr(pathname, *path_sep);
         if (p == NULL) {
@@ -54,16 +55,20 @@
             continue;
         }
         if (*(p-1) == ':' || *(p-1) == '\\') {
-            (void)_snprintf(buffer, buflen, "%.*s%s.dll", (p - pathname),
+            (void)_snprintf(buffer, buflen, "%.*s%s.dll", (int)(p - pathname),
                             pathname, fname);
         } else {
-            (void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (p - pathname),
+            (void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (int)(p - pathname),
                             pathname, fname);
         }
         if (_access(buffer, 0) == 0) {
             break;
         }
-        pathname = p + 1;
+        if (*p == '\0') {
+            pathname = p;
+        } else {
+            pathname = p + 1;
+        }
         *buffer = '\0';
     }
 }