diff src/os/linux/vm/os_linux.cpp @ 6988:2cb439954abf

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Gilles Duboscq <duboscq@ssw.jku.at>
date Mon, 19 Nov 2012 15:36:13 +0100
parents e522a00b91aa 6cb0d32b828b
children 291ffc492eb6
line wrap: on
line diff
--- a/src/os/linux/vm/os_linux.cpp	Sun Nov 18 22:45:43 2012 +0100
+++ b/src/os/linux/vm/os_linux.cpp	Mon Nov 19 15:36:13 2012 +0100
@@ -1650,19 +1650,20 @@
   return os::stat(filename, &statbuf) == 0;
 }
 
-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;
   // Copied from libhpi
   const size_t pnamelen = pname ? strlen(pname) : 0;
 
-  // Quietly truncate on buffer overflow.  Should be an error.
+  // Return error on buffer overflow.
   if (pnamelen + strlen(fname) + 10 > (size_t) buflen) {
-      *buffer = '\0';
-      return;
+    return retval;
   }
 
   if (pnamelen == 0) {
     snprintf(buffer, buflen, "lib%s.so", fname);
+    retval = true;
   } else if (strchr(pname, *os::path_separator()) != NULL) {
     int n;
     char** pelements = split_path(pname, &n);
@@ -1673,6 +1674,7 @@
       }
       snprintf(buffer, buflen, "%s/lib%s.so", pelements[i], fname);
       if (file_exists(buffer)) {
+        retval = true;
         break;
       }
     }
@@ -1687,7 +1689,9 @@
     }
   } else {
     snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
-  }
+    retval = true;
+  }
+  return retval;
 }
 
 const char* os::get_current_directory(char *buf, int buflen) {