Merge branch 'fix-atomic-rename-Windows-sharing-violation' into release

This commit is contained in:
Brad King 2014-05-13 15:25:47 -04:00
commit 5527cfa002
1 changed files with 4 additions and 2 deletions

View File

@ -917,8 +917,10 @@ bool cmSystemTools::RenameFile(const char* oldname, const char* newname)
cmsys::Encoding::ToWide(newname).c_str(), cmsys::Encoding::ToWide(newname).c_str(),
MOVEFILE_REPLACE_EXISTING) && --retry.Count) MOVEFILE_REPLACE_EXISTING) && --retry.Count)
{ {
// Try again only if failure was due to access permissions. DWORD last_error = GetLastError();
if(GetLastError() != ERROR_ACCESS_DENIED) // Try again only if failure was due to access/sharing permissions.
if(last_error != ERROR_ACCESS_DENIED &&
last_error != ERROR_SHARING_VIOLATION)
{ {
return false; return false;
} }