From: Zac Medico Date: Thu, 9 Feb 2006 01:38:34 +0000 (-0000) Subject: use atomic_ofstream for mtimedb commits X-Git-Tag: v2.1_pre5_2760~68 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f541d73d55ddbbd2e37ba45ea96deb1633eaebb0;p=portage.git use atomic_ofstream for mtimedb commits svn path=/main/trunk/; revision=2682 --- diff --git a/pym/portage.py b/pym/portage.py index 14992901f..339cd2e42 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -6878,13 +6878,17 @@ def commit_mtimedb(): if mtimedb: # Store mtimedb mymfn=mtimedbfile + f = None try: mtimedb["version"]=VERSION - cPickle.dump(mtimedb, open(mymfn,"w"), -1) + f = portage_util.atomic_ofstream(mymfn) + cPickle.dump(mtimedb, f, -1) + f.close() except SystemExit, e: raise except Exception, e: - pass + if f is not None: + f.abort() try: os.chown(mymfn,uid,portage_gid)