Blame SOURCES/abrt_friendly_hs_log_jdk7.patch

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