summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-02-19 04:09:20 +0000
committerZac Medico <zmedico@gentoo.org>2008-02-19 04:09:20 +0000
commite38811369ed6be37a8a9e142ba39d46881f09052 (patch)
tree63a807e809aa0841aa062f7b602f9d3f2797c4ec
parent856a0e33df9b9b64f9a7abe0e9b1fb34b0918794 (diff)
downloadportage-e38811369ed6be37a8a9e142ba39d46881f09052.tar.gz
portage-e38811369ed6be37a8a9e142ba39d46881f09052.tar.bz2
portage-e38811369ed6be37a8a9e142ba39d46881f09052.zip
Make PreservedLibsRegistry.store() use atomic_ofstream so that we don't
lose the whole registry if an error such as 'out of space' occurs. svn path=/main/trunk/; revision=9354
-rw-r--r--pym/portage/dbapi/vartree.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 703978133..b85976931 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -63,8 +63,10 @@ class PreservedLibsRegistry(object):
""" Store the registry data to file. No need to call this if autocommit
was enabled.
"""
- cPickle.dump(self._data, open(self._filename, "w"))
-
+ f = atomic_ofstream(self._filename)
+ cPickle.dump(self._data, f)
+ f.close()
+
def register(self, cpv, slot, counter, paths):
""" Register new objects in the registry. If there is a record with the
same packagename (internally derived from cpv) and slot it is