diff src/share/vm/utilities/vmError.cpp @ 21818:5ca2ea5eeff0

Merge
author asaha
date Fri, 31 Oct 2014 17:09:14 -0700
parents 833b0f92429a 60a992c821f8
children b1cf34d57e78
line wrap: on
line diff
--- a/src/share/vm/utilities/vmError.cpp	Fri Oct 24 17:09:30 2014 -0700
+++ b/src/share/vm/utilities/vmError.cpp	Fri Oct 31 17:09:14 2014 -0700
@@ -22,6 +22,7 @@
  *
  */
 
+#include <fcntl.h>
 #include "precompiled.hpp"
 #include "compiler/compileBroker.hpp"
 #include "gc_interface/collectedHeap.hpp"
@@ -841,7 +842,8 @@
 static int expand_and_open(const char* pattern, char* buf, size_t buflen, size_t pos) {
   int fd = -1;
   if (Arguments::copy_expand_pid(pattern, strlen(pattern), &buf[pos], buflen - pos)) {
-    fd = open(buf, O_RDWR | O_CREAT | O_TRUNC, 0666);
+    // the O_EXCL flag will cause the open to fail if the file exists
+    fd = open(buf, O_RDWR | O_CREAT | O_EXCL, 0666);
   }
   return fd;
 }