From: Zac Medico Date: Tue, 19 Feb 2008 04:09:20 +0000 (-0000) Subject: Make PreservedLibsRegistry.store() use atomic_ofstream so that we don't X-Git-Tag: v2.2_pre3~28 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e38811369ed6be37a8a9e142ba39d46881f09052;p=portage.git 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 --- 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