mirror of
https://github.com/znc/znc.git
synced 2026-05-08 14:24:45 +02:00
WriteToDisk() didn't make sure the file was empty when its map was empty
This bug was introduced by SilverLeo who also found and fixed it. :P git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1176 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
+8
-3
@@ -1001,10 +1001,15 @@ bool CString::RightChomp(unsigned int uLen) {
|
||||
|
||||
//////////////// MCString ////////////////
|
||||
int MCString::WriteToDisk(const CString& sPath, mode_t iMode) {
|
||||
if (this->empty())
|
||||
return MCS_SUCCESS;
|
||||
|
||||
CFile cFile(sPath);
|
||||
|
||||
if (this->empty()) {
|
||||
if (!cFile.Exists())
|
||||
return MCS_SUCCESS;
|
||||
if (cFile.Delete())
|
||||
return MCS_SUCCESS;
|
||||
}
|
||||
|
||||
if (!cFile.Open(O_WRONLY|O_CREAT|O_TRUNC, iMode)) {
|
||||
return MCS_EOPEN;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user