mirror of
https://github.com/znc/znc.git
synced 2026-05-03 20:12:29 +02:00
CFile::TryExLock(): Use O_RDWR by default
Getting an exclusive lock on a file with TryExLock() requires write access, therefor O_RDONLY is wrong here. This worked back when we were using flock() for file locking, because flock() doesn't need write access for an exclusive locks. This fixes a bug where "--makeconf" claims that there is already a znc instance running on the config file. This happened because it mis-interpreted the -EBADF error from fcntl() as "something else already has a lock". Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
@@ -110,7 +110,7 @@ public:
|
||||
void Close();
|
||||
void ClearBuffer();
|
||||
|
||||
bool TryExLock(const CString& sLockFile, int iFlags = O_RDONLY | O_CREAT);
|
||||
bool TryExLock(const CString& sLockFile, int iFlags = O_RDWR | O_CREAT);
|
||||
bool TryExLock();
|
||||
bool ExLock();
|
||||
bool UnLock();
|
||||
|
||||
Reference in New Issue
Block a user