mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +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
|
@ -145,11 +145,11 @@ static char* get_user_tmp_dir(const char* user) {
|
|||
|
||||
const char* tmpdir = os::get_temp_directory();
|
||||
const char* perfdir = PERFDATA_NAME;
|
||||
size_t nbytes = strlen(tmpdir) + strlen(perfdir) + strlen(user) + 2;
|
||||
size_t nbytes = strlen(tmpdir) + strlen(perfdir) + strlen(user) + 3;
|
||||
char* dirname = NEW_C_HEAP_ARRAY(char, nbytes);
|
||||
|
||||
// construct the path name to user specific tmp directory
|
||||
snprintf(dirname, nbytes, "%s%s_%s", tmpdir, perfdir, user);
|
||||
snprintf(dirname, nbytes, "%s/%s_%s", tmpdir, perfdir, user);
|
||||
|
||||
return dirname;
|
||||
}
|
||||
|
@ -331,8 +331,9 @@ static char* get_user_name_slow(int vmid, TRAPS) {
|
|||
}
|
||||
|
||||
char* usrdir_name = NEW_C_HEAP_ARRAY(char,
|
||||
strlen(tmpdirname) + strlen(dentry->d_name) + 1);
|
||||
strlen(tmpdirname) + strlen(dentry->d_name) + 2);
|
||||
strcpy(usrdir_name, tmpdirname);
|
||||
strcat(usrdir_name, "/");
|
||||
strcat(usrdir_name, dentry->d_name);
|
||||
|
||||
DIR* subdirp = os::opendir(usrdir_name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue