diff options
| author | viega | 1998-05-31 05:28:14 +0000 |
|---|---|---|
| committer | viega | 1998-05-31 05:28:14 +0000 |
| commit | 8707ccc08927c4d005e5d3e15f38c39c13e3158c (patch) | |
| tree | f30cfac4d63b17c5204b98879dba65a022bedf1f | |
| parent | 406eed48de108279f65385804904c8098ad10d01 (diff) | |
| download | mailman-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.
| -rw-r--r-- | Mailman/MailList.py | 8 | ||||
| -rw-r--r-- | modules/maillist.py | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/Mailman/MailList.py b/Mailman/MailList.py index 5fc44e499..268bea891 100644 --- a/Mailman/MailList.py +++ b/Mailman/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 = {} 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 = {} |
