diff src/share/vm/utilities/vmError.cpp @ 2130:34d64ad817f4

7009828: Fix for 6938627 breaks visualvm monitoring when -Djava.io.tmpdir is defined Summary: Change get_temp_directory() back to /tmp and %TEMP% like it always was and where the tools expect it to be. Reviewed-by: phh, dcubed, kamg, alanb
author coleenp
date Wed, 12 Jan 2011 13:59:18 -0800
parents 36c186bcc085
children d8a72fbc4be7
line wrap: on
line diff
--- a/src/share/vm/utilities/vmError.cpp	Wed Jan 12 15:44:16 2011 +0000
+++ b/src/share/vm/utilities/vmError.cpp	Wed Jan 12 13:59:18 2011 -0800
@@ -874,11 +874,13 @@
       }
 
       if (fd == -1) {
-        // try temp directory
         const char * tmpdir = os::get_temp_directory();
-        jio_snprintf(buffer, sizeof(buffer), "%s%shs_err_pid%u.log",
-                     tmpdir, os::file_separator(), os::current_process_id());
-        fd = open(buffer, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+        // try temp directory if it exists.
+        if (tmpdir != NULL && tmpdir[0] != '\0') {
+          jio_snprintf(buffer, sizeof(buffer), "%s%shs_err_pid%u.log",
+                       tmpdir, os::file_separator(), os::current_process_id());
+          fd = open(buffer, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+        }
       }
 
       if (fd != -1) {