[PATCH] D38817: Support: Work around missing SetFileInformationByHandle on Wine

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 11 14:26:29 PDT 2017


hans updated this revision to Diff 118695.
hans edited the summary of this revision.
hans added a comment.

Check for ERROR_CALL_NOT_IMPLEMENTED instead.


https://reviews.llvm.org/D38817

Files:
  lib/Support/Windows/Path.inc


Index: lib/Support/Windows/Path.inc
===================================================================
--- lib/Support/Windows/Path.inc
+++ lib/Support/Windows/Path.inc
@@ -413,6 +413,16 @@
   // a true error, so stop trying.
   for (unsigned Retry = 0; Retry != 200; ++Retry) {
     auto EC = rename_internal(FromHandle, To, true);
+
+    if (EC.value() == ERROR_CALL_NOT_IMPLEMENTED) {
+      // Wine doesn't support SetFileInformationByHandle in rename_internal.
+      // Fall back to MoveFileEx.
+      if (::MoveFileExW(WideFrom.begin(), WideTo.begin(),
+            MOVEFILE_REPLACE_EXISTING))
+        return std::error_code();
+      return mapWindowsError(GetLastError());
+    }
+
     if (!EC || EC != errc::permission_denied)
       return EC;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38817.118695.patch
Type: text/x-patch
Size: 760 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171011/ac759c28/attachment.bin>


More information about the llvm-commits mailing list