hotspot/src/os/linux/vm/os_linux.cpp
changeset 5237 aab592fd4f44
parent 5090 fd9498f26582
child 5410 c4b979417733
child 5403 6b0dd9c75dde
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Fri Mar 26 11:10:26 2010 -0400
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Wed Mar 31 16:51:18 2010 -0700
@@ -1522,7 +1522,10 @@
 
 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 @@
   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);