[llvm] r315597 - Work around lack of Wine support for SetFileInformationByHandle harder
Hans Wennborg via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 12 10:38:22 PDT 2017
Author: hans
Date: Thu Oct 12 10:38:22 2017
New Revision: 315597
URL: http://llvm.org/viewvc/llvm-project?rev=315597&view=rev
Log:
Work around lack of Wine support for SetFileInformationByHandle harder
In r315079 I added a check for the ERROR_CALL_NOT_IMPLEMENTED error
code, but it turns out earlier versions of Wine just returned false
without setting any error code.
This patch handles the unset error code case.
Modified:
llvm/trunk/lib/Support/Windows/Path.inc
Modified: llvm/trunk/lib/Support/Windows/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Path.inc?rev=315597&r1=315596&r2=315597&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Path.inc (original)
+++ llvm/trunk/lib/Support/Windows/Path.inc Thu Oct 12 10:38:22 2017
@@ -377,9 +377,14 @@ static std::error_code rename_internal(H
RenameInfo.FileNameLength = ToWide.size();
std::copy(ToWide.begin(), ToWide.end(), &RenameInfo.FileName[0]);
+ SetLastError(ERROR_SUCCESS);
if (!SetFileInformationByHandle(FromHandle, FileRenameInfo, &RenameInfo,
- RenameInfoBuf.size()))
- return mapWindowsError(GetLastError());
+ RenameInfoBuf.size())) {
+ unsigned Error = GetLastError();
+ if (Error == ERROR_SUCCESS)
+ Error = ERROR_CALL_NOT_IMPLEMENTED; // Wine doesn't always set error code.
+ return mapWindowsError(Error);
+ }
return std::error_code();
}
More information about the llvm-commits
mailing list