From 802ea1fc7a4f201f6147e63cf568a6eb7870d60d Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Wed, 21 Aug 2013 22:17:46 +0200 Subject: [PATCH] =?UTF-8?q?Treat=20most=20errors=20from=20exchangedata()?= =?UTF-8?q?=20as=20=E2=80=9Cnot=20supported=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- Frameworks/io/src/swap_file_data.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Frameworks/io/src/swap_file_data.cc b/Frameworks/io/src/swap_file_data.cc index 550e14d2..d7f4c565 100644 --- a/Frameworks/io/src/swap_file_data.cc +++ b/Frameworks/io/src/swap_file_data.cc @@ -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)