diff options
author | Eric Berge <ericmberge@gmail.com> | 2014-05-13 14:10:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-05-13 19:23:36 (GMT) |
commit | 24bd7ae11af5dc989e569fee8422018a92c4f23e (patch) | |
tree | 5e1524149bd107e422e4c23238e565cb950a776f /Source/cmSystemTools.cxx | |
parent | 9996b9846d5131e98d01c754eb50893d83314c3c (diff) | |
download | CMake-24bd7ae11af5dc989e569fee8422018a92c4f23e.zip CMake-24bd7ae11af5dc989e569fee8422018a92c4f23e.tar.gz CMake-24bd7ae11af5dc989e569fee8422018a92c4f23e.tar.bz2 |
cmSystemTools::RenameFile: Retry on Windows ERROR_SHARING_VIOLATION
Add ERROR_SHARING_VIOLATION to the set of errors (previously including
only ERROR_ACCESS_DENIED) that cause a rename (MoveFile) on Windows to
retry. The condition was observed when two renames to the same target
file name were happening simultaneously.
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index ff05975..c7acfd0 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -917,8 +917,10 @@ bool cmSystemTools::RenameFile(const char* oldname, const char* newname) cmsys::Encoding::ToWide(newname).c_str(), MOVEFILE_REPLACE_EXISTING) && --retry.Count) { - // Try again only if failure was due to access permissions. - if(GetLastError() != ERROR_ACCESS_DENIED) + DWORD last_error = GetLastError(); + // Try again only if failure was due to access/sharing permissions. + if(last_error != ERROR_ACCESS_DENIED && + last_error != ERROR_SHARING_VIOLATION) { return false; } |