When creating a dotlock, register it slightly earlier for cleanup

This closes a very unlikely window where we could create a dotlock file, but
then encounter an error and fail to clean up the dotlock.
This commit is contained in:
Nikolaus Schulz 2010-01-15 23:03:32 +01:00
parent 2b7baaf294
commit 4fb833176e
1 changed files with 1 additions and 1 deletions

View File

@ -398,11 +398,11 @@ class LockableMboxMixin:
raise LockUnavailable("Dotlock for '%s' unavailable" % self.mbox_file_name)
else:
raise
_stale.dotlock_files.append(lock_name)
finally:
os.close(plfd)
os.unlink(prelock_name)
vprint("acquired lockfile '%s'" % lock_name)
_stale.dotlock_files.append(lock_name)
def _dotlock_unlock(self):
"""Delete the dotlock file for the 'mbox' mailbox."""