forked from OSchip/llvm-project
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
This commit is contained in:
parent
63e87f5a02
commit
477c974bc8
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue