From 8d35b981c623de4c46afd933b0e7ac63aa7ca622 Mon Sep 17 00:00:00 2001 From: Ladislav Zezula Date: Thu, 3 Jul 2025 09:33:14 +0200 Subject: Fixed Linux build --- src/FileStream.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/FileStream.cpp b/src/FileStream.cpp index b5a0a6d..95f48a7 100644 --- a/src/FileStream.cpp +++ b/src/FileStream.cpp @@ -99,7 +99,7 @@ static bool BaseFile_Create(TFileStream * pStream) if(handle == -1) { pStream->Base.File.hFile = INVALID_HANDLE_VALUE; - dwLastError = errno; + SErrSetLastError(errno); return false; } @@ -152,7 +152,7 @@ static bool BaseFile_Open(TFileStream * pStream, const TCHAR * szFileName, DWORD if(handle == -1) { pStream->Base.File.hFile = INVALID_HANDLE_VALUE; - dwLastError = errno; + SErrSetLastError(errno); return false; } @@ -160,7 +160,7 @@ static bool BaseFile_Open(TFileStream * pStream, const TCHAR * szFileName, DWORD if(fstat64(handle, &fileinfo) == -1) { pStream->Base.File.hFile = INVALID_HANDLE_VALUE; - dwLastError = errno; + SErrSetLastError(errno); close(handle); return false; } @@ -230,7 +230,7 @@ static bool BaseFile_Read( bytes_read = read((intptr_t)pStream->Base.File.hFile, pvBuffer, (size_t)dwBytesToRead); if(bytes_read == -1) { - dwLastError = errno; + SErrSetLastError(errno); return false; } @@ -299,7 +299,7 @@ static bool BaseFile_Write(TFileStream * pStream, ULONGLONG * pByteOffset, const bytes_written = write((intptr_t)pStream->Base.File.hFile, pvBuffer, (size_t)dwBytesToWrite); if(bytes_written == -1) { - dwLastError = errno; + SErrSetLastError(errno); return false; } @@ -354,7 +354,7 @@ static bool BaseFile_Resize(TFileStream * pStream, ULONGLONG NewFileSize) { if(ftruncate64((intptr_t)pStream->Base.File.hFile, (off64_t)NewFileSize) == -1) { - dwLastError = errno; + SErrSetLastError(errno); return false; } @@ -398,7 +398,7 @@ static bool BaseFile_Replace(TFileStream * pStream, TFileStream * pNewStream) // "rename" on Linux also works if the target file exists if(rename(pNewStream->szFileName, pStream->szFileName) == -1) { - dwLastError = errno; + SErrSetLastError(errno); return false; } @@ -580,7 +580,7 @@ static bool BaseMap_Open(TFileStream * pStream, LPCTSTR szFileName, DWORD dwStre // Did the mapping fail? if(bResult == false) - dwLastError = errno; + SErrSetLastError(errno); return bResult; #else -- cgit v1.2.3