Don't try the lock until we know the file exists

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@478 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
prozacx
2005-09-09 04:47:32 +00:00
parent 94630d2b74
commit 92ebeef3b9

10
znc.cpp
View File

@@ -368,12 +368,12 @@ bool CZNC::WriteNewConfig(const CString& sConfig) {
vector<CString> vsLines;
bool bAnswer = false;
if (!m_LockFile.TryExLock(m_sConfigFile, 50)) {
CUtils::PrintError("ZNC is currently running on this config.");
return false;
}
if (CFile::Exists(sConfigFile)) {
if (!m_LockFile.TryExLock(sConfigFile, 50)) {
CUtils::PrintError("ZNC is currently running on this config.");
return false;
}
if (!CUtils::GetBoolInput("This config already exists. Would you like to overwrite it?", false)) {
return false;
}