1.1 --- a/src/share/vm/utilities/vmError.cpp Fri Oct 24 17:09:30 2014 -0700 1.2 +++ b/src/share/vm/utilities/vmError.cpp Fri Oct 31 17:09:14 2014 -0700 1.3 @@ -22,6 +22,7 @@ 1.4 * 1.5 */ 1.6 1.7 +#include <fcntl.h> 1.8 #include "precompiled.hpp" 1.9 #include "compiler/compileBroker.hpp" 1.10 #include "gc_interface/collectedHeap.hpp" 1.11 @@ -841,7 +842,8 @@ 1.12 static int expand_and_open(const char* pattern, char* buf, size_t buflen, size_t pos) { 1.13 int fd = -1; 1.14 if (Arguments::copy_expand_pid(pattern, strlen(pattern), &buf[pos], buflen - pos)) { 1.15 - fd = open(buf, O_RDWR | O_CREAT | O_TRUNC, 0666); 1.16 + // the O_EXCL flag will cause the open to fail if the file exists 1.17 + fd = open(buf, O_RDWR | O_CREAT | O_EXCL, 0666); 1.18 } 1.19 return fd; 1.20 }