From 3be33dd6c8c376afeb6c27959b451731f242d4b3 Mon Sep 17 00:00:00 2001 From: psychon Date: Tue, 1 Apr 2008 09:01:55 +0000 Subject: [PATCH] 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 --- String.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/String.cpp b/String.cpp index da9c67e3..eed9e3ae 100644 --- a/String.cpp +++ b/String.cpp @@ -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; }