]> git.michaelhowe.org Git - packages/b/bup.git/commitdiff
cmd/bloom: actually, always use the same temp filename.
authorAvery Pennarun <apenwarr@gmail.com>
Mon, 7 Feb 2011 09:28:06 +0000 (01:28 -0800)
committerAvery Pennarun <apenwarr@gmail.com>
Mon, 7 Feb 2011 09:31:49 +0000 (01:31 -0800)
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 <apenwarr@gmail.com>
cmd/bloom-cmd.py

index 434be3204d8fc3f85ec70ced3514499f1acddf82..eb962a7c6fe843590b40d5d11979031ec03d2888 100755 (executable)
@@ -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