6938627: Make temporary directory use property java.io.tmpdir when specified

Get java.io.tmpdir property in os::get_temp_directory() and call this instead of harcoding "/tmp".  Don't assume trailing file_separator either.

Reviewed-by: dholmes, kamg
This commit is contained in:
Coleen Phillimore 2010-03-31 16:51:18 -07:00
parent 7aaaad73cf
commit 47cda47c42
11 changed files with 83 additions and 51 deletions

View file

@ -1414,9 +1414,14 @@ void CompileBroker::init_compiler_thread_log() {
intx thread_id = os::current_thread_id();
for (int try_temp_dir = 1; try_temp_dir >= 0; try_temp_dir--) {
const char* dir = (try_temp_dir ? os::get_temp_directory() : NULL);
if (dir == NULL) dir = "";
sprintf(fileBuf, "%shs_c" UINTX_FORMAT "_pid%u.log",
dir, thread_id, os::current_process_id());
if (dir == NULL) {
jio_snprintf(fileBuf, sizeof(fileBuf), "hs_c" UINTX_FORMAT "_pid%u.log",
thread_id, os::current_process_id());
} else {
jio_snprintf(fileBuf, sizeof(fileBuf),
"%s%shs_c" UINTX_FORMAT "_pid%u.log", dir,
os::file_separator(), thread_id, os::current_process_id());
}
fp = fopen(fileBuf, "at");
if (fp != NULL) {
file = NEW_C_HEAP_ARRAY(char, strlen(fileBuf)+1);