[PATCH] D50048: [Windows FS] Fall back to MoveFileEx for rename across volumes

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 31 03:39:07 PDT 2018


jmorse created this revision.
jmorse added reviewers: stella.stamenova, JDevlieghere, zturner.
Herald added a subscriber: llvm-commits.

In r338216 and https://reviews.llvm.org/D49860 we permitted MoveFileEx to copy between volumes -- but before it can, the more posix-y rename_internal fails. Allow rename_handle to fall back on MoveFileEx for this specific error.


Repository:
  rL LLVM

https://reviews.llvm.org/D50048

Files:
  lib/Support/Windows/Path.inc


Index: lib/Support/Windows/Path.inc
===================================================================
--- lib/Support/Windows/Path.inc
+++ lib/Support/Windows/Path.inc
@@ -442,10 +442,12 @@
   for (unsigned Retry = 0; Retry != 200; ++Retry) {
     auto EC = rename_internal(FromHandle, To, true);
 
-    if (EC ==
-        std::error_code(ERROR_CALL_NOT_IMPLEMENTED, std::system_category())) {
-      // Wine doesn't support SetFileInformationByHandle in rename_internal.
-      // Fall back to MoveFileEx.
+    if ((EC ==
+        std::error_code(ERROR_CALL_NOT_IMPLEMENTED, std::system_category())) ||
+        (EC ==
+        std::error_code(ERROR_NOT_SAME_DEVICE, std::system_category()))) {
+      // Wine doesn't support SetFileInformationByHandle in rename_internal,
+      // or cross-device rename requested. Fall back to MoveFileEx.
       SmallVector<wchar_t, MAX_PATH> WideFrom;
       if (std::error_code EC2 = realPathFromHandle(FromHandle, WideFrom))
         return EC2;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50048.158198.patch
Type: text/x-patch
Size: 989 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180731/d7fbd119/attachment.bin>


More information about the llvm-commits mailing list