diff options
author | Greg Bedwell <greg_bedwell@sn.scee.net> | 2015-10-12 15:11:47 +0000 |
---|---|---|
committer | Greg Bedwell <greg_bedwell@sn.scee.net> | 2015-10-12 15:11:47 +0000 |
commit | 7f68a7166925b4d5e1a4c5a8eea5f6689352b89d (patch) | |
tree | 48d8bcebe721af95c5f7ec7ad713c774e53e014f /llvm/lib/Support/StringRef.cpp | |
parent | 3b732ac7eeeab398211beae85e134523d514718e (diff) | |
download | bcm5719-llvm-7f68a7166925b4d5e1a4c5a8eea5f6689352b89d.tar.gz bcm5719-llvm-7f68a7166925b4d5e1a4c5a8eea5f6689352b89d.zip |
Fix rename() sometimes failing if another process uses openFileForRead()
On Windows, fs::rename() could fail is another process was reading the
file at the same time using fs::openFileForRead(). In most cases the user
wouldn't notice as fs::rename() will continue to retry for 2000ms. Typically
this is enough for the read to complete and a retry to succeed, but if the
disk is being it too hard then the response time might be longer than the
retry time and the rename would fail with a permission error.
Add FILE_SHARE_DELETE to the sharing flags for CreateFileW() in
fs::openFileForRead() and try ReplaceFileW() prior to MoveFileExW()
in fs::rename().
Based on an initial patch by Edd Dawson!
Differential Revision: http://reviews.llvm.org/D13647
llvm-svn: 250046
Diffstat (limited to 'llvm/lib/Support/StringRef.cpp')
0 files changed, 0 insertions, 0 deletions