diff src/share/vm/utilities/vmError.cpp @ 20779:d7b6bdd51abe jdk8u31-b10

8050807: Better performing performance data handling Reviewed-by: dcubed, pnauman, ctornqvi, dholmes, mschoene Contributed-by: gerald.thornbrugh@oracle.com
author gthornbr
date Mon, 17 Nov 2014 15:51:46 -0500
parents f73af4455d7d
children 42f27b59c550 5ca2ea5eeff0
line wrap: on
line diff
--- a/src/share/vm/utilities/vmError.cpp	Mon Nov 24 09:18:13 2014 -0800
+++ b/src/share/vm/utilities/vmError.cpp	Mon Nov 17 15:51:46 2014 -0500
@@ -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;
 }