hotspot/src/share/vm/utilities/vmError.cpp
changeset 7901 ea3d83447861
parent 7719 ef138e2849eb
child 8114 340b5b8b544b
--- a/hotspot/src/share/vm/utilities/vmError.cpp	Wed Jan 12 15:44:16 2011 +0000
+++ b/hotspot/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) {