From 9140a0dbd5dc2b73ccba256a9f12f653ed1c80cb Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 30 Oct 2011 13:42:36 +0100 Subject: [PATCH] CZNC::WriteConfig(): Better --debug output Signed-off-by: Uli Schlachter --- src/znc.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/znc.cpp b/src/znc.cpp index 20a188a3..949c5069 100644 --- a/src/znc.cpp +++ b/src/znc.cpp @@ -357,6 +357,7 @@ CString CZNC::ExpandConfigPath(const CString& sConfigFile, bool bAllowMkDir) { bool CZNC::WriteConfig() { if (GetConfigFile().empty()) { + DEBUG("Config file name is empty?!"); return false; } @@ -364,6 +365,7 @@ bool CZNC::WriteConfig() { CFile *pFile = new CFile(GetConfigFile() + "~"); if (!pFile->Open(O_WRONLY | O_CREAT | O_TRUNC, 0600)) { + DEBUG("Could not write config to " + GetConfigFile() + "~: " + CString(strerror(errno))); delete pFile; return false; } @@ -372,6 +374,7 @@ bool CZNC::WriteConfig() { // The old file (= inode) is going away and thus a lock on it would be // useless. These lock should always succeed (races, anyone?). if (!pFile->TryExLock()) { + DEBUG("Error while locking the new config file, errno says: " + CString(strerror(errno))); pFile->Delete(); delete pFile; return false; @@ -465,7 +468,7 @@ bool CZNC::WriteConfig() { // We wrote to a temporary name, move it to the right place if (!pFile->Move(GetConfigFile(), true)) { - DEBUG("Error while replacing the config file with a new version"); + DEBUG("Error while replacing the config file with a new version, errno says " << strerror(errno)); pFile->Delete(); delete pFile; return false;