8223885: hs_err and replay file may contain garbage when overwriting existing file
authorthartmann
Wed, 15 May 2019 14:30:22 +0200
changeset 54881 80991d58b947
parent 54880 b0b20413d853
child 54882 b99e97bc5040
8223885: hs_err and replay file may contain garbage when overwriting existing file Summary: Truncate file before overwriting. Reviewed-by: stuefe, dholmes
src/hotspot/share/utilities/vmError.cpp
test/hotspot/jtreg/ProblemList.txt
--- a/src/hotspot/share/utilities/vmError.cpp	Wed May 15 11:53:47 2019 +0200
+++ b/src/hotspot/share/utilities/vmError.cpp	Wed May 15 14:30:22 2019 +0200
@@ -1198,7 +1198,7 @@
 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, 0666);
+    fd = open(buf, O_RDWR | O_CREAT | O_TRUNC, 0666);
   }
   return fd;
 }
--- a/test/hotspot/jtreg/ProblemList.txt	Wed May 15 11:53:47 2019 +0200
+++ b/test/hotspot/jtreg/ProblemList.txt	Wed May 15 14:30:22 2019 +0200
@@ -41,7 +41,6 @@
 # :hotspot_compiler
 
 compiler/ciReplay/TestSAServer.java 8029528 generic-all
-compiler/ciReplay/TestServerVM.java 8223885 generic-all
 compiler/codecache/stress/OverloadCompileQueueTest.java 8166554 generic-all
 compiler/codegen/Test6896617.java 8193479 generic-all
 compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java 8140405 generic-all