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.
llvm-svn: 315597
diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc
index 5866f9a..3146263 100644
--- a/llvm/lib/Support/Windows/Path.inc
+++ b/llvm/lib/Support/Windows/Path.inc
@@ -377,9 +377,14 @@
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();
}