Fixed crash when open(..) returns an error.
This commit is contained in:
@@ -87,13 +87,12 @@ XBaseParser::XBaseParser(const std::string fileName):
|
||||
if (fileName.empty() == false)
|
||||
{
|
||||
#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() );
|
||||
if (fd) close( fd );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user