mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
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:
parent
7aaaad73cf
commit
47cda47c42
11 changed files with 83 additions and 51 deletions
|
@ -1522,7 +1522,10 @@ int os::current_process_id() {
|
|||
|
||||
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;
|
||||
|
@ -2305,7 +2308,8 @@ void linux_wrap_code(char* base, size_t size) {
|
|||
char buf[40];
|
||||
int num = Atomic::add(1, &cnt);
|
||||
|
||||
sprintf(buf, "/tmp/hs-vm-%d-%d", os::current_process_id(), num);
|
||||
snprintf(buf, sizeof(buf), "%s/hs-vm-%d-%d",
|
||||
os::get_temp_directory(), os::current_process_id(), num);
|
||||
unlink(buf);
|
||||
|
||||
int fd = open(buf, O_CREAT | O_RDWR, S_IRWXU);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue