aboutsummaryrefslogtreecommitdiffstats
path: root/archivemail
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2010-07-30 13:24:36 +0200
committerNikolaus Schulz <microschulz@web.de>2010-07-30 13:24:36 +0200
commiteadedf27d09776b2ad59364a86fa1af6cbe86525 (patch)
treecccb951816765824fd899376deb9bf563da1dbe9 /archivemail
parent71485f2469ca49bc04fe35d5993f1ef560393399 (diff)
downloadarchivemail-eadedf27d09776b2ad59364a86fa1af6cbe86525.tar.gz
archivemail-eadedf27d09776b2ad59364a86fa1af6cbe86525.tar.bz2
archivemail-eadedf27d09776b2ad59364a86fa1af6cbe86525.zip
Fix crash when unlocking an mbox after dotlocking failed with EACCES
If we don't have sufficient permissions to create a dotlock for an mbox file, record that, and don't try to remove the dotlock when unlocking the mbox later.
Diffstat (limited to 'archivemail')
-rwxr-xr-xarchivemail5
1 files changed, 4 insertions, 1 deletions
diff --git a/archivemail b/archivemail
index be90413..ec05171 100755
--- a/archivemail
+++ b/archivemail
@@ -323,6 +323,7 @@ class LockableMboxMixin:
self.mbox_file = mbox_file
self.mbox_file_name = mbox_file_name
self._locked = False
+ self._use_dotlock = True
def lock(self):
"""Lock this mbox with both a dotlock and a posix lock."""
@@ -386,6 +387,7 @@ class LockableMboxMixin:
if not options.quiet:
user_warning("no write permissions: omitting dotlock for '%s'" % \
self.mbox_file_name)
+ self._use_dotlock = False
return
raise
try:
@@ -411,7 +413,8 @@ class LockableMboxMixin:
def _dotlock_unlock(self):
"""Delete the dotlock file for the 'mbox' mailbox."""
- assert self.mbox_file_name
+ if not self._use_dotlock:
+ return
lock_name = self.mbox_file_name + options.lockfile_extension
vprint("removing lockfile '%s'" % lock_name)
os.remove(lock_name)