Skip to content

Commit 31b2891

Browse files
authored
bug fix (#209)
1 parent b85b5cb commit 31b2891

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: src/filelock/_unix.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ class UnixFileLock(BaseFileLock):
3333
def _acquire(self) -> None:
3434
open_flags = os.O_RDWR | os.O_CREAT | os.O_TRUNC
3535
fd = os.open(self._lock_file, open_flags)
36-
os.chmod(fd, self._mode)
36+
try:
37+
os.chmod(fd, self._mode)
38+
except PermissionError:
39+
pass # This locked is not owned by this UID
3740
try:
3841
fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
3942
except OSError:

0 commit comments

Comments
 (0)