Update renameat2.cpp

This commit is contained in:
tavplubix 2020-12-01 13:22:29 +03:00 committed by GitHub
parent 0b5261b1af
commit 88133860d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,6 +67,10 @@ static bool renameat2(const std::string & old_path, const std::string & new_path
/// Other cases when EINVAL can be returned should never happen.
if (errno == EINVAL)
return false;
/// We should never get ENOSYS on Linux, because we check kernel version in supportsRenameat2Impl().
/// However, we can get in on WSL.
if (errno == ENOSYS)
return false;
if (errno == EEXIST)
throwFromErrno("Cannot rename " + old_path + " to " + new_path + " because the second path already exists", ErrorCodes::ATOMIC_RENAME_FAIL);