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

@ -676,15 +676,6 @@ bool os::have_special_privileges() {
}
static char* get_property(char* name, char* buffer, int buffer_size) {
if (os::getenv(name, buffer, buffer_size)) {
return buffer;
}
static char empty[] = "";
return empty;
}
void os::init_system_properties_values() {
char arch[12];
sysinfo(SI_ARCHITECTURE, arch, sizeof(arch));
@ -1826,7 +1817,10 @@ void os::set_error_file(const char *logfile) {}
const char* os::dll_file_extension() { return ".so"; }
const char* os::get_temp_directory() { return "/tmp/"; }
const char* os::get_temp_directory() {
const char *prop = Arguments::get_property("java.io.tmpdir");
return prop == NULL ? "/tmp" : prop;
}
static bool file_exists(const char* filename) {
struct stat statbuf;