From 8ce6d1af302eb3c0a702eabda02dbd6a317ececa Mon Sep 17 00:00:00 2001 From: Unrud Date: Thu, 4 Aug 2016 06:15:05 +0200 Subject: [PATCH] Use flock locks for storage locking These locks are compatible with the command line utility flock, which comes preinstalled with most Linux distributions. --- radicale/storage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radicale/storage.py b/radicale/storage.py index 10cffc1..88f6b14 100644 --- a/radicale/storage.py +++ b/radicale/storage.py @@ -648,7 +648,7 @@ class Collection(BaseCollection): elif os.name == "posix": _cmd = fcntl.LOCK_EX if mode == "w" else fcntl.LOCK_SH try: - fcntl.lockf(cls._lock_file.fileno(), _cmd) + fcntl.flock(cls._lock_file.fileno(), _cmd) except OSError: cls.logger.debug("Locking not supported") cls._lock_file_locked = True @@ -668,7 +668,7 @@ class Collection(BaseCollection): cls.logger.debug("Unlocking not supported") elif os.name == "posix": try: - fcntl.lockf(cls._lock_file.fileno(), fcntl.LOCK_UN) + fcntl.flock(cls._lock_file.fileno(), fcntl.LOCK_UN) except OSError: cls.logger.debug("Unlocking not supported") cls._lock_file_locked = False