diff options
author | Ladislav Zezula <zezula@volny.cz> | 2021-03-31 08:00:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-31 08:00:09 +0200 |
commit | b8c83a5cd67d5535f56bf42223a3c13e2a630026 (patch) | |
tree | fb916d458e5ec3a9ad58d85be1de25e133c5c0dd /src | |
parent | bd4d6bdd418ed25f15a162bff84f6b7921a39aaf (diff) | |
parent | d7a3aec8126abb4f9258aa41dcf6db550b315471 (diff) |
Merge pull request #208 from glebm/invalidate-handle
FileStream: Ensure file handle invalidation on error
Diffstat (limited to 'src')
-rw-r--r-- | src/FileStream.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/FileStream.cpp b/src/FileStream.cpp index a7b3e6a..45499e1 100644 --- a/src/FileStream.cpp +++ b/src/FileStream.cpp @@ -113,6 +113,7 @@ static bool BaseFile_Create(TFileStream * pStream) if(handle == -1)
{
nLastError = errno;
+ pStream->Base.File.hFile = INVALID_HANDLE_VALUE;
return false;
}
@@ -165,6 +166,7 @@ static bool BaseFile_Open(TFileStream * pStream, const TCHAR * szFileName, DWORD if(handle == -1)
{
nLastError = errno;
+ pStream->Base.File.hFile = INVALID_HANDLE_VALUE;
return false;
}
@@ -173,6 +175,7 @@ static bool BaseFile_Open(TFileStream * pStream, const TCHAR * szFileName, DWORD {
nLastError = errno;
close(handle);
+ pStream->Base.File.hFile = INVALID_HANDLE_VALUE;
return false;
}
|