Permalink
Browse files

Fixed crash when open(..) returns an error.

  • Loading branch information...
1 parent 5b6c71e commit 5bf3233368cf0f3ed5bcae33f42db5e75a78e7f6 @osg-training-guest osg-training-guest committed Jul 23, 2013
Showing with 2 additions and 3 deletions.
  1. +2 −3 src/osgPlugins/shp/XBaseParser.cpp
@@ -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;
}
}

0 comments on commit 5bf3233

Please sign in to comment.