mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Fix for OpenBSD and don't busy loop for file locks
I don't think there is a high change that the file lock becomes available in the short time we did loop and retry the lock, so that code served no real purpose. Also, this includes unistd.h in Utils.h which is needed for OpenBSD. Thanks to fred for testing on his openbsd/sparc box. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@918 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
6
znc.cpp
6
znc.cpp
@@ -186,7 +186,7 @@ bool CZNC::WriteISpoof(CUser* pUser) {
|
||||
|
||||
if (!m_sISpoofFile.empty()) {
|
||||
m_pISpoofLockFile = new CLockFile;
|
||||
if(!m_pISpoofLockFile->TryExLock(m_sISpoofFile, 50, true)) {
|
||||
if(!m_pISpoofLockFile->TryExLock(m_sISpoofFile, true)) {
|
||||
delete m_pISpoofLockFile;
|
||||
m_pISpoofLockFile = NULL;
|
||||
return false;
|
||||
@@ -457,7 +457,7 @@ bool CZNC::WriteNewConfig(const CString& sConfig) {
|
||||
vector<CString> vsLines;
|
||||
|
||||
if (CFile::Exists(sConfigFile)) {
|
||||
if (!m_LockFile.TryExLock(sConfigFile, 50)) {
|
||||
if (!m_LockFile.TryExLock(sConfigFile)) {
|
||||
CUtils::PrintError("ZNC is currently running on this config.");
|
||||
return false;
|
||||
}
|
||||
@@ -760,7 +760,7 @@ bool CZNC::ParseConfig(const CString& sConfig) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_LockFile.TryExLock(m_sConfigFile, 50)) {
|
||||
if (!m_LockFile.TryExLock(m_sConfigFile)) {
|
||||
CUtils::PrintStatus(false, "ZNC is already running on this config.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user