comparison src/share/vm/compiler/compileBroker.cpp @ 1353:a2ea687fdc7c

6938627: Make temporary directory use property java.io.tmpdir when specified Summary: 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
author coleenp
date Wed, 31 Mar 2010 16:51:18 -0700
parents 428a9c451986
children 35069ca331f2 bfe29ec02863
comparison
equal deleted inserted replaced
1330:4a9cc99938e3 1353:a2ea687fdc7c
1412 FILE* fp = NULL; 1412 FILE* fp = NULL;
1413 char* file = NULL; 1413 char* file = NULL;
1414 intx thread_id = os::current_thread_id(); 1414 intx thread_id = os::current_thread_id();
1415 for (int try_temp_dir = 1; try_temp_dir >= 0; try_temp_dir--) { 1415 for (int try_temp_dir = 1; try_temp_dir >= 0; try_temp_dir--) {
1416 const char* dir = (try_temp_dir ? os::get_temp_directory() : NULL); 1416 const char* dir = (try_temp_dir ? os::get_temp_directory() : NULL);
1417 if (dir == NULL) dir = ""; 1417 if (dir == NULL) {
1418 sprintf(fileBuf, "%shs_c" UINTX_FORMAT "_pid%u.log", 1418 jio_snprintf(fileBuf, sizeof(fileBuf), "hs_c" UINTX_FORMAT "_pid%u.log",
1419 dir, thread_id, os::current_process_id()); 1419 thread_id, os::current_process_id());
1420 } else {
1421 jio_snprintf(fileBuf, sizeof(fileBuf),
1422 "%s%shs_c" UINTX_FORMAT "_pid%u.log", dir,
1423 os::file_separator(), thread_id, os::current_process_id());
1424 }
1420 fp = fopen(fileBuf, "at"); 1425 fp = fopen(fileBuf, "at");
1421 if (fp != NULL) { 1426 if (fp != NULL) {
1422 file = NEW_C_HEAP_ARRAY(char, strlen(fileBuf)+1); 1427 file = NEW_C_HEAP_ARRAY(char, strlen(fileBuf)+1);
1423 strcpy(file, fileBuf); 1428 strcpy(file, fileBuf);
1424 break; 1429 break;