8009397: test/com/sun/jdi/PrivateTransportTest.sh: ERROR: transport library missing onLoad entry: private_dt_socket
authorsla
Tue, 05 Mar 2013 19:25:35 +0100
changeset 16057 16a81953a291
parent 16056 2d02a05cd526
child 16058 5b8d8cec6280
8009397: test/com/sun/jdi/PrivateTransportTest.sh: ERROR: transport library missing onLoad entry: private_dt_socket Reviewed-by: alanb
jdk/src/share/back/transport.c
jdk/src/share/demo/jvmti/hprof/hprof_init.c
jdk/src/solaris/back/linker_md.c
jdk/src/solaris/demo/jvmti/hprof/hprof_md.c
jdk/src/windows/back/linker_md.c
jdk/src/windows/demo/jvmti/hprof/hprof_md.c
--- a/jdk/src/share/back/transport.c	Tue Mar 05 11:49:33 2013 -0800
+++ b/jdk/src/share/back/transport.c	Tue Mar 05 19:25:35 2013 +0100
@@ -117,6 +117,9 @@
 
     /* Construct library name (simple name or full path) */
     dbgsysBuildLibName(libname, sizeof(libname), plibdir, name);
+    if (strlen(libname) == 0) {
+        return NULL;
+    }
 
     /* dlopen (unix) / LoadLibrary (windows) the transport library */
     handle = dbgsysLoadLibrary(libname, buf, sizeof(buf));
--- a/jdk/src/share/demo/jvmti/hprof/hprof_init.c	Tue Mar 05 11:49:33 2013 -0800
+++ b/jdk/src/share/demo/jvmti/hprof/hprof_init.c	Tue Mar 05 19:25:35 2013 +0100
@@ -1899,11 +1899,17 @@
      */
     getSystemProperty("sun.boot.library.path", &boot_path);
     md_build_library_name(lname, FILENAME_MAX, boot_path, name);
+    if ( strlen(lname) == 0 ) {
+        HPROF_ERROR(JNI_TRUE, "Could not find library");
+    }
     jvmtiDeallocate(boot_path);
     handle = md_load_library(lname, err_buf, (int)sizeof(err_buf));
     if ( handle == NULL ) {
         /* This may be necessary on Windows. */
         md_build_library_name(lname, FILENAME_MAX, "", name);
+        if ( strlen(lname) == 0 ) {
+            HPROF_ERROR(JNI_TRUE, "Could not find library");
+        }
         handle = md_load_library(lname, err_buf, (int)sizeof(err_buf));
         if ( handle == NULL ) {
             HPROF_ERROR(JNI_TRUE, err_buf);
@@ -1968,6 +1974,9 @@
     getSystemProperty("sun.boot.library.path", &boot_path);
     /* Load in NPT library for character conversions */
     md_build_library_name(npt_lib, sizeof(npt_lib), boot_path, NPT_LIBNAME);
+    if ( strlen(npt_lib) == 0 ) {
+        HPROF_ERROR(JNI_TRUE, "Could not find npt library");
+    }
     jvmtiDeallocate(boot_path);
     NPT_INITIALIZE(npt_lib, &(gdata->npt), NPT_VERSION, NULL);
     if ( gdata->npt == NULL ) {
--- a/jdk/src/solaris/back/linker_md.c	Tue Mar 05 11:49:33 2013 -0800
+++ b/jdk/src/solaris/back/linker_md.c	Tue Mar 05 19:25:35 2013 +0100
@@ -60,6 +60,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) {
@@ -69,13 +70,17 @@
         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;
         }
-        pathname = p + 1;
+        if (*p == '\0') {
+            pathname = p;
+        } else {
+            pathname = p + 1;
+        }
         *buffer = '\0';
     }
 }
--- a/jdk/src/solaris/demo/jvmti/hprof/hprof_md.c	Tue Mar 05 11:49:33 2013 -0800
+++ b/jdk/src/solaris/demo/jvmti/hprof/hprof_md.c	Tue Mar 05 19:25:35 2013 +0100
@@ -385,6 +385,7 @@
     // Loosely based on os_solaris.cpp
 
       char *pathname = (char *)pname;
+      *buffer = '\0';
       while (strlen(pathname) > 0) {
           char *p = strchr(pathname, ':');
           if (p == NULL) {
@@ -395,12 +396,16 @@
               continue;
           }
           (void)snprintf(buffer, buflen, "%.*s/lib%s" JNI_LIB_SUFFIX,
-                         (p - pathname), pathname, fname);
+                         (int)(p - pathname), pathname, fname);
 
           if (access(buffer, F_OK) == 0) {
-            break;
+              break;
           }
-          pathname = p + 1;
+          if (*p == '\0') {
+              pathname = p;
+          } else {
+              pathname = p + 1;
+          }
           *buffer = '\0';
       }
 }
--- 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';
     }
 }
--- a/jdk/src/windows/demo/jvmti/hprof/hprof_md.c	Tue Mar 05 11:49:33 2013 -0800
+++ b/jdk/src/windows/demo/jvmti/hprof/hprof_md.c	Tue Mar 05 19:25:35 2013 +0100
@@ -372,6 +372,7 @@
     // Loosley based on os_windows.cpp
 
     char *pathname = (char *)pname;
+    *buffer = '\0';
     while (strlen(pathname) > 0) {
         char *p = strchr(pathname, ';');
         if (p == NULL) {
@@ -382,16 +383,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';
     }
 }