Don't create empty .registry files for module data

This command showed a *lot* of empty files in ZNC's data dir
  find ~/.znc -iname ".registry" -size 0|wc -l

Thanks to SilverLeo


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1010 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-04-01 09:01:55 +00:00
parent 58a6a8f0e8
commit 3be33dd6c8

View File

@@ -944,6 +944,9 @@ 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 (!cFile.Open(O_WRONLY|O_CREAT|O_TRUNC, iMode)) {
return MCS_EOPEN;
@@ -973,7 +976,7 @@ int MCString::WriteToDisk(const CString& sPath, mode_t iMode) {
int MCString::ReadFromDisk(const CString& sPath, mode_t iMode) {
clear();
CFile cFile(sPath);
if (!cFile.Open(O_RDONLY|O_CREAT, iMode)) {
if (!cFile.Open(O_RDONLY, iMode)) {
return MCS_EOPEN;
}