Skip to content

Commit 664ef4e

Browse files
committed
Fix cross-device rename_or_delete
1 parent bcdfac1 commit 664ef4e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/vcpkg/base/files.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2031,14 +2031,15 @@ namespace vcpkg
20312031
{
20322032
this->rename(old_path, new_path, ec);
20332033
using namespace std::chrono_literals;
2034+
std::error_code local_ec;
20342035
for (const auto& delay : {10ms, 100ms, 1000ms, 10000ms})
20352036
{
20362037
if (!ec)
20372038
{
20382039
return true;
20392040
}
20402041
else if (ec == std::make_error_condition(std::errc::directory_not_empty) ||
2041-
ec == std::make_error_condition(std::errc::file_exists) || this->exists(new_path, ec))
2042+
ec == std::make_error_condition(std::errc::file_exists) || this->exists(new_path, local_ec))
20422043
{
20432044
// either the rename failed with a target already exists error, or the target explicitly exists,
20442045
// assume another process 'won' the 'CAS'.

0 commit comments

Comments
 (0)