Mercurial > hg > graal-compiler
comparison src/share/vm/utilities/vmError.cpp @ 8026:8bf62bd86a4e
8007791: More Restricted hs_err file permission
Summary: Enforce more restricted hs_file permission
Reviewed-by: acorn, dcubed, dsamersoff
author | zgu |
---|---|
date | Fri, 08 Feb 2013 14:49:01 -0500 |
parents | 9deda4d8e126 |
children | 5ee2b330eacd |
comparison
equal
deleted
inserted
replaced
8024:7194f764221c | 8026:8bf62bd86a4e |
---|---|
915 | 915 |
916 if (ErrorFile != NULL) { | 916 if (ErrorFile != NULL) { |
917 bool copy_ok = | 917 bool copy_ok = |
918 Arguments::copy_expand_pid(ErrorFile, strlen(ErrorFile), buffer, sizeof(buffer)); | 918 Arguments::copy_expand_pid(ErrorFile, strlen(ErrorFile), buffer, sizeof(buffer)); |
919 if (copy_ok) { | 919 if (copy_ok) { |
920 fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666); | 920 fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0600); |
921 } | 921 } |
922 } | 922 } |
923 | 923 |
924 if (fd == -1) { | 924 if (fd == -1) { |
925 const char *cwd = os::get_current_directory(buffer, sizeof(buffer)); | 925 const char *cwd = os::get_current_directory(buffer, sizeof(buffer)); |
926 size_t len = strlen(cwd); | 926 size_t len = strlen(cwd); |
927 // either user didn't specify, or the user's location failed, | 927 // either user didn't specify, or the user's location failed, |
928 // so use the default name in the current directory | 928 // so use the default name in the current directory |
929 jio_snprintf(&buffer[len], sizeof(buffer)-len, "%shs_err_pid%u.log", | 929 jio_snprintf(&buffer[len], sizeof(buffer)-len, "%shs_err_pid%u.log", |
930 os::file_separator(), os::current_process_id()); | 930 os::file_separator(), os::current_process_id()); |
931 fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666); | 931 fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0600); |
932 } | 932 } |
933 | 933 |
934 if (fd == -1) { | 934 if (fd == -1) { |
935 const char * tmpdir = os::get_temp_directory(); | 935 const char * tmpdir = os::get_temp_directory(); |
936 // try temp directory if it exists. | 936 // try temp directory if it exists. |
937 if (tmpdir != NULL && tmpdir[0] != '\0') { | 937 if (tmpdir != NULL && tmpdir[0] != '\0') { |
938 jio_snprintf(buffer, sizeof(buffer), "%s%shs_err_pid%u.log", | 938 jio_snprintf(buffer, sizeof(buffer), "%s%shs_err_pid%u.log", |
939 tmpdir, os::file_separator(), os::current_process_id()); | 939 tmpdir, os::file_separator(), os::current_process_id()); |
940 fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666); | 940 fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0600); |
941 } | 941 } |
942 } | 942 } |
943 | 943 |
944 if (fd != -1) { | 944 if (fd != -1) { |
945 out.print_raw("# An error report file with more information is saved as:\n# "); | 945 out.print_raw("# An error report file with more information is saved as:\n# "); |