From ec1373c772b06c7ec386f338ea19b5a20aa13c45 Mon Sep 17 00:00:00 2001 From: Gregory Taeger Date: Thu, 23 Mar 2023 12:52:03 -0400 Subject: [PATCH 1/3] bug fix --- src/filelock/_unix.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/filelock/_unix.py b/src/filelock/_unix.py index 20161235..ee2fd79a 100644 --- a/src/filelock/_unix.py +++ b/src/filelock/_unix.py @@ -33,7 +33,10 @@ class UnixFileLock(BaseFileLock): def _acquire(self) -> None: open_flags = os.O_RDWR | os.O_CREAT | os.O_TRUNC fd = os.open(self._lock_file, open_flags) - os.chmod(fd, self._mode) + try: + os.chmod(fd, self._mode) + except PermissionError: + pass # This locked isnt owned by this UID try: fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB) except OSError: From db790e43ee1a886e9effe89d18849c71ee8b90d8 Mon Sep 17 00:00:00 2001 From: Gregory Taeger Date: Thu, 23 Mar 2023 12:56:53 -0400 Subject: [PATCH 2/3] fix typo --- src/filelock/_unix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/filelock/_unix.py b/src/filelock/_unix.py index ee2fd79a..cc4eefa6 100644 --- a/src/filelock/_unix.py +++ b/src/filelock/_unix.py @@ -36,7 +36,7 @@ def _acquire(self) -> None: try: os.chmod(fd, self._mode) except PermissionError: - pass # This locked isnt owned by this UID + pass # This locked is not owned by this UID try: fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB) except OSError: From 177a9af8315487416071b30699600a6b5358c26d Mon Sep 17 00:00:00 2001 From: Gregory Taeger Date: Thu, 23 Mar 2023 12:58:54 -0400 Subject: [PATCH 3/3] black formatter fix --- src/filelock/_unix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/filelock/_unix.py b/src/filelock/_unix.py index cc4eefa6..e58823f3 100644 --- a/src/filelock/_unix.py +++ b/src/filelock/_unix.py @@ -36,7 +36,7 @@ def _acquire(self) -> None: try: os.chmod(fd, self._mode) except PermissionError: - pass # This locked is not owned by this UID + pass # This locked is not owned by this UID try: fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB) except OSError: