hotspot/src/os/windows/vm/os_windows.cpp
changeset 14471 f3a6b82e25cf
parent 14284 ceb386367065
child 14626 0cf4eccf130f
child 14583 d70ee55535f4
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Mon Nov 05 19:33:44 2012 -0500
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Wed Nov 07 17:53:02 2012 -0500
@@ -1132,21 +1132,23 @@
   return GetFileAttributes(filename) != INVALID_FILE_ATTRIBUTES;
 }
 
-void os::dll_build_name(char *buffer, size_t buflen,
+bool os::dll_build_name(char *buffer, size_t buflen,
                         const char* pname, const char* fname) {
+  bool retval = false;
   const size_t pnamelen = pname ? strlen(pname) : 0;
   const char c = (pnamelen > 0) ? pname[pnamelen-1] : 0;
 
-  // Quietly truncates on buffer overflow. Should be an error.
+  // Return error on buffer overflow.
   if (pnamelen + strlen(fname) + 10 > buflen) {
-    *buffer = '\0';
-    return;
+    return retval;
   }
 
   if (pnamelen == 0) {
     jio_snprintf(buffer, buflen, "%s.dll", fname);
+    retval = true;
   } else if (c == ':' || c == '\\') {
     jio_snprintf(buffer, buflen, "%s%s.dll", pname, fname);
+    retval = true;
   } else if (strchr(pname, *os::path_separator()) != NULL) {
     int n;
     char** pelements = split_path(pname, &n);
@@ -1164,6 +1166,7 @@
         jio_snprintf(buffer, buflen, "%s\\%s.dll", path, fname);
       }
       if (file_exists(buffer)) {
+        retval = true;
         break;
       }
     }
@@ -1178,7 +1181,9 @@
     }
   } else {
     jio_snprintf(buffer, buflen, "%s\\%s.dll", pname, fname);
-  }
+    retval = true;
+  }
+  return retval;
 }
 
 // Needs to be in os specific directory because windows requires another