summaryrefslogtreecommitdiff
path: root/modules/maillist.py
diff options
context:
space:
mode:
authorviega1998-05-31 05:28:14 +0000
committerviega1998-05-31 05:28:14 +0000
commit8707ccc08927c4d005e5d3e15f38c39c13e3158c (patch)
treef30cfac4d63b17c5204b98879dba65a022bedf1f /modules/maillist.py
parent406eed48de108279f65385804904c8098ad10d01 (diff)
downloadmailman-8707ccc08927c4d005e5d3e15f38c39c13e3158c.tar.gz
mailman-8707ccc08927c4d005e5d3e15f38c39c13e3158c.tar.zst
mailman-8707ccc08927c4d005e5d3e15f38c39c13e3158c.zip
As a safety measure, copy over the list config file to config.last
before we write out a new one. I got hosed once on my big list when the process got killed by some load dog software when it was in the middle of writing out the database.
Diffstat (limited to 'modules/maillist.py')
-rw-r--r--modules/maillist.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/maillist.py b/modules/maillist.py
index 5fc44e499..268bea891 100644
--- a/modules/maillist.py
+++ b/modules/maillist.py
@@ -520,7 +520,13 @@ class MailList(MailCommandHandler, HTMLFormatter, Deliverer, ListAdmin,
self.IsListInitialized()
ou = os.umask(002)
try:
- file = open(os.path.join(self._full_path, 'config.db'), 'w')
+ fname = os.path.join(self._full_path, 'config.db')
+ fname_last = fname + ".last"
+ if os.path.exists(fname_last):
+ os.unlink(fname_last)
+ os.link(fname, fname_last)
+ os.unlink(fname)
+ file = open(fname, 'w')
finally:
os.umask(ou)
dict = {}