Blame SOURCES/abrt_friendly_hs_log_jdk7.patch

295329
--- openjdk/hotspot/src/share/vm/utilities/vmError.cpp	2012-02-02 16:17:24.476664897 +0100
295329
+++ openjdk/hotspot/src/share/vm/utilities/vmError.cpp	2012-02-02 16:17:24.476664897 +0100
295329
@@ -929,6 +929,7 @@
295329
         }
295329
       }
295329
 
295329
+      /*
295329
       if (fd == -1) {
295329
         const char *cwd = os::get_current_directory(buffer, sizeof(buffer));
295329
         size_t len = strlen(cwd);
295329
@@ -938,6 +939,24 @@
295329
                      os::file_separator(), os::current_process_id());
295329
         fd = open(buffer, O_RDWR | O_CREAT | O_EXCL, 0666);
295329
       }
295329
+      */
295329
+
295329
+      if (fd == -1) {
295329
+        const char * tmpdir = os::get_temp_directory();
295329
+        // try temp directory if it exists.
295329
+        if (tmpdir != NULL && tmpdir[0] != '\0') {
295329
+          jio_snprintf(buffer, sizeof(buffer), "%s%sjvm-%u",
295329
+                       tmpdir, os::file_separator(), os::current_process_id());
295329
+          // if mkdir() failed, hs_err will be created in temporary directory
295329
+          if (!mkdir(buffer, 0700)) { // only read+execute flags are needed
295329
+                                      // but we need to write into the directory too
295329
+            jio_snprintf(buffer, sizeof(buffer), "%s%sjvm-%u%shs_error.log",
295329
+                           tmpdir, os::file_separator(), os::current_process_id(),
295329
+                           os::file_separator());
295329
+            fd = open(buffer, O_WRONLY | O_CREAT | O_EXCL, 0444); // read-only file 
295329
+          }
295329
+        }
295329
+      }
295329
 
295329
       if (fd == -1) {
295329
         const char * tmpdir = os::get_temp_directory();