1.1 --- a/src/share/vm/memory/filemap.cpp Sat Feb 02 20:13:27 2013 +0100 1.2 +++ b/src/share/vm/memory/filemap.cpp Sun Feb 03 16:49:16 2013 -0500 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -210,13 +210,14 @@ 1.11 tty->print_cr(" %s", _full_path); 1.12 } 1.13 1.14 - // Remove the existing file in case another process has it open. 1.15 +#ifdef _WINDOWS // On Windows, need WRITE permission to remove the file. 1.16 + chmod(_full_path, _S_IREAD | _S_IWRITE); 1.17 +#endif 1.18 + 1.19 + // Use remove() to delete the existing file because, on Unix, this will 1.20 + // allow processes that have it open continued access to the file. 1.21 remove(_full_path); 1.22 -#ifdef _WINDOWS // if 0444 is used on Windows, then remove() will fail. 1.23 - int fd = open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0744); 1.24 -#else 1.25 int fd = open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0444); 1.26 -#endif 1.27 if (fd < 0) { 1.28 fail_stop("Unable to create shared archive file %s.", _full_path); 1.29 }