# HG changeset patch # User hseigel # Date 1359929551 18000 # Node ID ce5467120c84ee0ed5e923b1fb9cc94bdb96e692 # Parent c4ef3380a70bc7234b4f0e6f6119b12476f3a1ec# Parent 8f696cf1a0fb92f9c41208254b6b35e7a0273c7e Merge diff -r 8f696cf1a0fb -r ce5467120c84 src/share/vm/memory/filemap.cpp --- a/src/share/vm/memory/filemap.cpp Sun Feb 03 22:28:08 2013 +0400 +++ b/src/share/vm/memory/filemap.cpp Sun Feb 03 17:12:31 2013 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, 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 @@ -210,13 +210,14 @@ 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); -#ifdef _WINDOWS // if 0444 is used on Windows, then remove() will fail. - int fd = open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0744); -#else int fd = open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0444); -#endif if (fd < 0) { fail_stop("Unable to create shared archive file %s.", _full_path); }