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, 0600); |
920 fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666); |
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, 0600); |
931 fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666); |
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, 0600); |
940 fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666); |
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# "); |