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
//////////////// 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;
}