changeset 7352:8666e625f2a4

8060721: Test runtime/SharedArchiveFile/LimitSharedSizes.java fails in jdk 9 fcs new platforms/compiler Summary: replaced strcat() with jio_snprintf() Reviewed-by: dholmes, iklam, dlong, minqi
author ccheung
date Mon, 10 Nov 2014 10:13:10 -0800
parents b67cf1387c96
children 425d09fb378b a014a4dff55b
files src/share/vm/memory/metaspaceShared.cpp
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/memory/metaspaceShared.cpp	Fri Nov 07 12:48:09 2014 -0800
+++ b/src/share/vm/memory/metaspaceShared.cpp	Mon Nov 10 10:13:10 2014 -0800
@@ -715,15 +715,17 @@
     if (class_list_path_len >= 3) {
       if (strcmp(class_list_path_str + class_list_path_len - 3, "lib") != 0) {
         if (class_list_path_len < JVM_MAXPATHLEN - 4) {
-          strncat(class_list_path_str, os::file_separator(), 1);
-          strncat(class_list_path_str, "lib", 3);
+          jio_snprintf(class_list_path_str + class_list_path_len,
+                       sizeof(class_list_path_str) - class_list_path_len,
+                       "%slib", os::file_separator());
+          class_list_path_len += 4;
         }
       }
     }
-    class_list_path_len = (int)strlen(class_list_path_str);
     if (class_list_path_len < JVM_MAXPATHLEN - 10) {
-      strncat(class_list_path_str, os::file_separator(), 1);
-      strncat(class_list_path_str, "classlist", 9);
+      jio_snprintf(class_list_path_str + class_list_path_len,
+                   sizeof(class_list_path_str) - class_list_path_len,
+                   "%sclasslist", os::file_separator());
     }
     class_list_path = class_list_path_str;
   } else {