diff src/share/vm/utilities/vmError.cpp @ 21816:60a992c821f8

8050807: Better performing performance data handling Reviewed-by: dcubed, dholmes, pnauman, ctornqvi, mschoene Contributed-by: gerald.thornbrugh@oracle.com
author hseigel
date Fri, 24 Oct 2014 15:02:37 -0400
parents f73af4455d7d
children 42f27b59c550 5ca2ea5eeff0
line wrap: on
line diff
--- a/src/share/vm/utilities/vmError.cpp	Mon Oct 20 23:02:07 2014 -0700
+++ b/src/share/vm/utilities/vmError.cpp	Fri Oct 24 15:02:37 2014 -0400
@@ -22,6 +22,7 @@
  *
  */
 
+#include <fcntl.h>
 #include "precompiled.hpp"
 #include "compiler/compileBroker.hpp"
 #include "gc_interface/collectedHeap.hpp"
@@ -836,7 +837,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;
 }