From: Avery Pennarun Date: Mon, 7 Feb 2011 09:28:06 +0000 (-0800) Subject: cmd/bloom: actually, always use the same temp filename. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=87a715aa531fa17fa12148b7b2c837c8fc874e2f;p=packages%2Fb%2Fbup.git cmd/bloom: actually, always use the same temp filename. There's no reason to use a different temp filename every time, since we're going to just be overwriting the same output file anyhow. And if we got interrupted, we left the temp file lying around. Let's just always use the same temp filename, which means if we get interrupted, we'll clean it up next time. Signed-off-by: Avery Pennarun --- diff --git a/cmd/bloom-cmd.py b/cmd/bloom-cmd.py index 434be32..eb962a7 100755 --- a/cmd/bloom-cmd.py +++ b/cmd/bloom-cmd.py @@ -62,8 +62,8 @@ def do_bloom(path, outfilename): tempname = None if b is None: - tfd,tfname = tempfile.mkstemp(dir=path, suffix='bup.bloom') - tf = os.fdopen(tfd, 'w+') + tfname = os.path.join(path, 'bup.tmp.bloom') + tf = open(tfname, 'w+') b = git.ShaBloom.create( tfname, f=tf, readwrite=True, expected=add_count, k=opt.k) count = 0