aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2008-08-09 03:27:25 +0200
committerNikolaus Schulz <microschulz@web.de>2010-07-19 01:13:24 +0200
commit54821151e4f0a9a8891bbc3d4f1f552e00ca1c3a (patch)
tree0c2ac2a16ac635c5bf463665749fb36ed3f81ff5
parenta7414319c9d21f271d75e82cb3efa2e3ceffaa68 (diff)
downloadarchivemail-54821151e4f0a9a8891bbc3d4f1f552e00ca1c3a.tar.gz
archivemail-54821151e4f0a9a8891bbc3d4f1f552e00ca1c3a.tar.bz2
archivemail-54821151e4f0a9a8891bbc3d4f1f552e00ca1c3a.zip
Fix minor race when deleting messages in a maildir/mh box
Nothing serious, but if another client deleted it in the small window after we checked it, we would have crashed trying to delete a non-existing file.
-rwxr-xr-xarchivemail.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/archivemail.py b/archivemail.py
index 4fae631..c62fbcd 100755
--- a/archivemail.py
+++ b/archivemail.py
@@ -1220,9 +1220,10 @@ def _archive_dir(mailbox_name, final_archive_name, type):
if archive:
archive.finalise()
for file_name in delete_queue:
- if os.path.isfile(file_name):
- vprint("removing original message: '%s'" % file_name)
- os.remove(file_name)
+ vprint("removing original message: '%s'" % file_name)
+ try: os.remove(file_name)
+ except OSError, e:
+ if e.errno != errno.ENOENT: raise
if not options.quiet:
stats.display()