Add more error handling for close() calls.

This commit is contained in:
Jon Siwek 2012-07-26 12:40:12 -05:00
parent d872b1d9f6
commit 734e5f68d3
7 changed files with 47 additions and 19 deletions

View file

@ -746,7 +746,7 @@ FileSerializer::~FileSerializer()
if ( io )
delete io; // destructor will call close() on fd
else if ( fd >= 0 )
close(fd);
safe_close(fd);
}
bool FileSerializer::Open(const char* file, bool pure)
@ -810,7 +810,7 @@ void FileSerializer::CloseFile()
io->Flush();
if ( fd >= 0 && ! io ) // destructor of io calls close() on fd
close(fd);
safe_close(fd);
fd = -1;
delete [] file;