Files
znc/FileUtils.h
Uli Schlachter cc2d84d4a6 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>
2011-03-31 18:10:02 +02:00

7.1 KiB