Fix server crash when nvault is writting to journal file without write permission (bug 3231, r=Arkshine)

This commit is contained in:
Nextra 2013-07-02 10:20:21 +02:00
parent 28aa4dfbf7
commit 6ad9e6bc8c
2 changed files with 10 additions and 3 deletions

View File

@ -129,7 +129,9 @@ bool Journal::Begin()
bool Journal::End() bool Journal::End()
{ {
fclose(m_fp); if (m_fp)
fclose(m_fp);
m_Bw.SetFilePtr(NULL); m_Bw.SetFilePtr(NULL);
return true; return true;
} }

View File

@ -266,8 +266,13 @@ bool NVault::Close()
return false; return false;
_SaveToFile(); _SaveToFile();
m_Journal->End();
m_Journal->Erase(); if (m_Journal)
{
m_Journal->End();
m_Journal->Erase();
}
m_Open = false; m_Open = false;
return true; return true;