summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-02-09 01:38:34 +0000
committerZac Medico <zmedico@gentoo.org>2006-02-09 01:38:34 +0000
commitf541d73d55ddbbd2e37ba45ea96deb1633eaebb0 (patch)
tree29861e888d12eaa54e1d25626231fbeb7594b549
parentcbc38717d510b106a27dabeec517111fcd54a5b0 (diff)
downloadportage-f541d73d55ddbbd2e37ba45ea96deb1633eaebb0.tar.gz
portage-f541d73d55ddbbd2e37ba45ea96deb1633eaebb0.tar.bz2
portage-f541d73d55ddbbd2e37ba45ea96deb1633eaebb0.zip
use atomic_ofstream for mtimedb commits
svn path=/main/trunk/; revision=2682
-rw-r--r--pym/portage.py8
1 files changed, 6 insertions, 2 deletions
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)