Remove the pid file when ZNC exits

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@948 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-02-08 20:52:20 +00:00
parent f035753fc3
commit 9a1c3874bc
2 changed files with 23 additions and 0 deletions
+22
View File
@@ -53,6 +53,8 @@ CZNC::~CZNC() {
#ifdef _MODULES
delete m_pModules;
#endif
DeletePidFile();
}
CString CZNC::GetTag(bool bIncludeVersion) {
@@ -263,6 +265,26 @@ bool CZNC::WritePidFile(int iPid) {
return false;
}
bool CZNC::DeletePidFile() {
if (!m_sPidFile.empty()) {
CString sFile;
// absolute path or relative to the data dir?
if (m_sPidFile[0] != '/')
sFile = GetZNCPath() + "/" + m_sPidFile;
else
sFile = m_sPidFile;
CFile File(sFile);
CUtils::PrintAction("Deleting pid file [" + sFile + "]");
if (File.Delete()) {
CUtils::PrintStatus(true);
return true;
}
CUtils::PrintStatus(false);
}
return false;
}
bool CZNC::WritePemFile( bool bEncPem ) {
#ifndef HAVE_LIBSSL
CUtils::PrintError("ZNC was not compiled with ssl support.");