mirror of
https://github.com/znc/znc.git
synced 2026-07-05 01:11:53 +02:00
Reuse the FD for locking the config for reading it
This saves us one whole open() :P Honestly, this fixes some (stupid) locking problems with cygwin and shouldn't hurt much otherwise (And no, cygwin still isn't supported yet). git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1020 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -909,11 +909,12 @@ bool CZNC::DoRehash(CString& sError)
|
||||
return false;
|
||||
}
|
||||
|
||||
CFile File(m_sConfigFile);
|
||||
CFile File(m_LockFile.GetFD(), m_sConfigFile);
|
||||
|
||||
if (!File.Open(O_RDONLY)) {
|
||||
sError = "Could not open config";
|
||||
CUtils::PrintStatus(false);
|
||||
// This fd is re-used for rehashing, so we must seek back to the beginning!
|
||||
if (!File.Seek(0)) {
|
||||
sError = "Could not seek to the beginning of the config.";
|
||||
CUtils::PrintStatus(false, sError);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user