8007791: More Restricted hs_err file permission
authorzgu
Fri, 08 Feb 2013 14:49:01 -0500
changeset 15596 7f7fa6987ca4
parent 15594 b1a3f5beb8b3
child 15597 b9ec29960f2b
8007791: More Restricted hs_err file permission Summary: Enforce more restricted hs_file permission Reviewed-by: acorn, dcubed, dsamersoff
hotspot/src/share/vm/utilities/vmError.cpp
--- a/hotspot/src/share/vm/utilities/vmError.cpp	Fri Feb 08 14:05:36 2013 +0100
+++ b/hotspot/src/share/vm/utilities/vmError.cpp	Fri Feb 08 14:49:01 2013 -0500
@@ -917,7 +917,7 @@
         bool copy_ok =
           Arguments::copy_expand_pid(ErrorFile, strlen(ErrorFile), buffer, sizeof(buffer));
         if (copy_ok) {
-          fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666);
+          fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0600);
         }
       }
 
@@ -928,7 +928,7 @@
         // so use the default name in the current directory
         jio_snprintf(&buffer[len], sizeof(buffer)-len, "%shs_err_pid%u.log",
                      os::file_separator(), os::current_process_id());
-        fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666);
+        fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0600);
       }
 
       if (fd == -1) {
@@ -937,7 +937,7 @@
         if (tmpdir != NULL && tmpdir[0] != '\0') {
           jio_snprintf(buffer, sizeof(buffer), "%s%shs_err_pid%u.log",
                        tmpdir, os::file_separator(), os::current_process_id());
-          fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666);
+          fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0600);
         }
       }