diff src/share/vm/utilities/vmError.cpp @ 20781:42f27b59c550

Merge
author asaha
date Wed, 26 Nov 2014 08:57:40 -0800
parents 417e3b8d04c5 d7b6bdd51abe
children 7848fc12602b f3ffb37f88a6 9989538b7507
line wrap: on
line diff
--- a/src/share/vm/utilities/vmError.cpp	Wed Nov 26 08:14:21 2014 -0800
+++ b/src/share/vm/utilities/vmError.cpp	Wed Nov 26 08:57:40 2014 -0800
@@ -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;
 }