Skip to content

Commit

Permalink
CheckedFile: Fix recent change for errno on Windows (#120)
Browse files Browse the repository at this point in the history
The error needs to be checked for non-zero, not negative like an fd.

Fixes commit e7edc4f
  • Loading branch information
asmaloney authored Oct 8, 2022
1 parent e7edc4f commit 1d79580
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/CheckedFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ int CheckedFile::open64( const ustring &fileName, int flags, int mode )
std::wstring widePath = converter.from_bytes( fileName );

int handle;
int err = _wsopen_s( &handle, widePath.c_str(), flags, _SH_DENYNO, mode );
if ( err < 0 )
errno_t err = _wsopen_s( &handle, widePath.c_str(), flags, _SH_DENYNO, mode );
if ( err != 0 )
{
throw E57_EXCEPTION2( E57_ERROR_OPEN_FAILED, "errno=" + toString( errno ) + " error='" + strerror( errno ) +
"' fileName=" + fileName + " flags=" + toString( flags ) +
Expand Down

0 comments on commit 1d79580

Please sign in to comment.