Fixed leak when open returns 0

This commit is contained in:
Robert Osfield
2016-06-28 15:33:06 +01:00
parent 07a0b52e6c
commit 4f276d9d8e

View File

@@ -20,9 +20,9 @@ ESRIShapeParser::ESRIShapeParser( const std::string fileName, bool useDouble ):
if( !fileName.empty() )
{
#ifdef WIN32
if( (fd = open( fileName.c_str(), O_RDONLY | O_BINARY )) <= 0 )
if( (fd = open( fileName.c_str(), O_RDONLY | O_BINARY )) < 0 )
#else
if( (fd = open( fileName.c_str(), O_RDONLY )) <= 0 )
if( (fd = open( fileName.c_str(), O_RDONLY )) < 0 )
#endif
{
perror( fileName.c_str() );