Treat most errors from exchangedata() as “not supported”

It seems to be a general trend with network file systems to return wrong errors when they do not support a certain feature (like extended attributes and atomic swap).
This commit is contained in:
Allan Odgaard
2013-08-21 22:17:46 +02:00
parent c8802cc534
commit 802ea1fc7a

View File

@@ -16,8 +16,12 @@ namespace path
if(exchangedata(src.c_str(), dst.c_str(), 0) == 0)
return unlink(src.c_str()) == 0;
if(errno == EFAULT) // Workaround for ExpanDrive
if(errno != ENOTSUP && errno != ENOENT && errno != EXDEV)
{
// ExpanDrive returns EFAULT
fprintf(stderr, "warning: exchangedata(“%s”, “%s”) failed with “%s”, treating as “%s”.\n", src.c_str(), dst.c_str(), strerror(errno), strerror(ENOTSUP));
errno = ENOTSUP;
}
D(DBF_IO_Swap_File_Data, bug("exchangedata() failed: %s\n", strerror(errno)););
if(errno == ENOTSUP || errno == ENOENT)