mirror of
https://github.com/znc/znc.git
synced 2026-08-07 01:13:25 +02:00
Only expand the PidFile config option when writing the pid file.
This way if we rewrite the config PidFile gets the same value it had when znc was started. -> we don't turn it into an absolute path which is bad if data dir is changed git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@839 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -241,8 +241,16 @@ void CZNC::ReleaseISpoof() {
|
|||||||
|
|
||||||
bool CZNC::WritePidFile(int iPid) {
|
bool CZNC::WritePidFile(int iPid) {
|
||||||
if (!m_sPidFile.empty()) {
|
if (!m_sPidFile.empty()) {
|
||||||
CFile File(m_sPidFile);
|
CString sFile;
|
||||||
CUtils::PrintAction("Writing pid file [" + m_sPidFile + "]");
|
|
||||||
|
// 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("Writing pid file [" + sFile + "]");
|
||||||
|
|
||||||
if (File.Open(O_WRONLY | O_TRUNC | O_CREAT)) {
|
if (File.Open(O_WRONLY | O_TRUNC | O_CREAT)) {
|
||||||
File.Write(CString(iPid) + "\n");
|
File.Write(CString(iPid) + "\n");
|
||||||
@@ -1174,12 +1182,7 @@ bool CZNC::ParseConfig(const CString& sConfig) {
|
|||||||
AddVHost(sValue);
|
AddVHost(sValue);
|
||||||
continue;
|
continue;
|
||||||
} else if (sName.CaseCmp("PidFile") == 0) {
|
} else if (sName.CaseCmp("PidFile") == 0) {
|
||||||
if (!sValue.empty() && sValue[0] != '/') {
|
m_sPidFile = sValue;
|
||||||
m_sPidFile = GetZNCPath() + "/" + sValue;
|
|
||||||
} else {
|
|
||||||
m_sPidFile = sValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
} else if (sName.CaseCmp("StatusPrefix") == 0) {
|
} else if (sName.CaseCmp("StatusPrefix") == 0) {
|
||||||
m_sStatusPrefix = sValue;
|
m_sStatusPrefix = sValue;
|
||||||
|
|||||||
Reference in New Issue
Block a user