summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2017-10-12 17:38:22 +0000
committerHans Wennborg <hans@hanshq.net>2017-10-12 17:38:22 +0000
commit477c974bc8d3bce061b60e7deacbbc734ea3f162 (patch)
tree6cbd1b9072ab2419c9f4ff3c536ad5f948064244 /llvm/lib/Support
parent63e87f5a028c4c634479350de9e916e1cc8319cd (diff)
downloadbcm5719-llvm-477c974bc8d3bce061b60e7deacbbc734ea3f162.tar.gz
bcm5719-llvm-477c974bc8d3bce061b60e7deacbbc734ea3f162.zip
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
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/Windows/Path.inc9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc
index 5866f9a403a..31462633ee8 100644
--- a/llvm/lib/Support/Windows/Path.inc
+++ b/llvm/lib/Support/Windows/Path.inc
@@ -377,9 +377,14 @@ static std::error_code rename_internal(HANDLE FromHandle, const Twine &To,
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();
}
OpenPOWER on IntegriCloud