From 220d890f32f0b538e139a94008b490a8681676a8 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sun, 26 Jul 2020 15:22:24 +0200 Subject: [PATCH] fix locking on openindiana, fixes #5271 OI rmdir gives errno 17 EEXIST when trying to remove a non-empty dir, not ENOTEMPTY like other OSes. Also: fix one error handler to also use a tuple-member check instead of "or". --- src/borg/locking.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/borg/locking.py b/src/borg/locking.py index 34f5281fb..4ec2a4bf8 100644 --- a/src/borg/locking.py +++ b/src/borg/locking.py @@ -171,7 +171,7 @@ def release(self): try: os.rmdir(self.path) except OSError as err: - if err.errno not in (errno.ENOTEMPTY, errno.ENOENT): + if err.errno not in (errno.ENOTEMPTY, errno.EEXIST, errno.ENOENT): # EACCES or EIO or ... = we cannot operate anyway, so re-throw raise err # else: @@ -224,7 +224,7 @@ def kill_stale_lock(self): try: os.rmdir(self.path) except OSError as err: - if err.errno == errno.ENOTEMPTY or err.errno == errno.ENOENT: + if err.errno in (errno.ENOTEMPTY, errno.EEXIST, errno.ENOENT): # Directory is not empty or doesn't exist any more = we lost the race to somebody else--which is ok. return False # EACCES or EIO or ... = we cannot operate anyway