[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 15:04:27 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL315520: Support: Work around missing SetFileInformationByHandle on Wine (authored by hans).

Changed prior to commit:
  https://reviews.llvm.org/D38817?vs=118695&id=118708#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38817

Files:
  llvm/trunk/lib/Support/Windows/Path.inc


Index: llvm/trunk/lib/Support/Windows/Path.inc
===================================================================
--- llvm/trunk/lib/Support/Windows/Path.inc
+++ llvm/trunk/lib/Support/Windows/Path.inc
@@ -413,6 +413,17 @@
   // a true error, so stop trying.
   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 (::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.118708.patch
Type: text/x-patch
Size: 847 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171011/b551f556/attachment.bin>


More information about the llvm-commits mailing list