mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-27 09:50:34 +05:00
Fix a problem with the zero file descriptor.
This commit is contained in:
parent
f87f0664bb
commit
462fad4cea
@ -45,7 +45,13 @@ namespace boofs = boost::filesystem;
|
|||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
SMESH_File::SMESH_File(const std::string& name, bool open)
|
SMESH_File::SMESH_File(const std::string& name, bool open)
|
||||||
:_name(name), _size(-1), _file(0), _map(0), _pos(0), _end(0)
|
:_name(name), _size(-1),
|
||||||
|
#ifdef WIN32
|
||||||
|
_file(INVALID_HANDLE_VALUE),
|
||||||
|
#else
|
||||||
|
_file(-1),
|
||||||
|
#endif
|
||||||
|
_map(0), _pos(0), _end(0)
|
||||||
{
|
{
|
||||||
if ( open ) this->open();
|
if ( open ) this->open();
|
||||||
}
|
}
|
||||||
@ -138,11 +144,15 @@ void SMESH_File::close()
|
|||||||
else if ( _file >= 0 )
|
else if ( _file >= 0 )
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
CloseHandle(_file);
|
if(_file != INVALID_HANDLE_VALUE) {
|
||||||
_file = INVALID_HANDLE_VALUE;
|
CloseHandle(_file);
|
||||||
|
_file = INVALID_HANDLE_VALUE;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
::close(_file);
|
if(_file != -1) {
|
||||||
_file = -1;
|
::close(_file);
|
||||||
|
_file = -1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user