From e38811369ed6be37a8a9e142ba39d46881f09052 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 19 Feb 2008 04:09:20 +0000 Subject: 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 --- pym/portage/dbapi/vartree.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pym') 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 -- cgit v1.2.3-1-g7c22