Salome HOME
projects
/
modules
/
smesh.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f87f066
)
Fix a problem with the zero file descriptor.
author
rnv
<rnv@opencascade.com>
Mon, 5 May 2014 15:35:24 +0000
(19:35 +0400)
committer
rnv
<rnv@opencascade.com>
Mon, 5 May 2014 15:35:24 +0000
(19:35 +0400)
src/SMESHUtils/SMESH_File.cxx
patch
|
blob
|
history
diff --git
a/src/SMESHUtils/SMESH_File.cxx
b/src/SMESHUtils/SMESH_File.cxx
index b0720551629cf4757b476920df69f09241035e28..d4311bb71ef29464b7b926b689e2f1bbbc5dfa61 100644
(file)
--- a/
src/SMESHUtils/SMESH_File.cxx
+++ b/
src/SMESHUtils/SMESH_File.cxx
@@
-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 )
{
#ifdef WIN32
else if ( _file >= 0 )
{
#ifdef WIN32
- CloseHandle(_file);
- _file = INVALID_HANDLE_VALUE;
+ if(_file != INVALID_HANDLE_VALUE) {
+ CloseHandle(_file);
+ _file = INVALID_HANDLE_VALUE;
+ }
#else
#else
- ::close(_file);
- _file = -1;
+ if(_file != -1) {
+ ::close(_file);
+ _file = -1;
+ }
#endif
}
}
#endif
}
}