changeset 6028:fc789043683d jdk7u161-b00

7197672: There are issues with shared data on windows Summary: On Windows, set rw protection on the CDS file just before removing it. Reviewed-by: dcubed, iklam
author hseigel
date Mon, 27 Nov 2017 00:55:50 +0000
parents 8d1cd1a98556
children 2965926dc517
files src/share/vm/memory/filemap.cpp
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/memory/filemap.cpp	Mon Nov 27 00:38:41 2017 +0000
+++ b/src/share/vm/memory/filemap.cpp	Mon Nov 27 00:55:50 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -185,7 +185,12 @@
     tty->print_cr("   %s", _full_path);
   }
 
-  // Remove the existing file in case another process has it open.
+#ifdef _WINDOWS  // On Windows, need WRITE permission to remove the file.
+  chmod(_full_path, _S_IREAD | _S_IWRITE);
+#endif
+
+  // Use remove() to delete the existing file because, on Unix, this will
+  // allow processes that have it open continued access to the file.
   remove(_full_path);
   int fd = open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0444);
   if (fd < 0) {