]> mj.ucw.cz Git - libucw.git/commitdiff
Use bfix_tmp_file() whereever possible.
authorMartin Mares <mj@ucw.cz>
Sat, 25 Aug 2007 11:38:23 +0000 (13:38 +0200)
committerMartin Mares <mj@ucw.cz>
Sat, 25 Aug 2007 11:38:23 +0000 (13:38 +0200)
lib/sorter.h
lib/sorter/sorter.h

index eebd2206dfdee76c2d1ee10f84d3036f826cf954..4cc8c9951dd405bbb2c520ad290b6f8b8546ae51 100644 (file)
@@ -538,10 +538,7 @@ struct fastbuf *fb1, struct fastbuf *fb2
 #ifdef SORT_OUTPUT_FB
   return fb1;
 #else
-  bconfig(fb1, BCONFIG_IS_TEMP_FILE, 0);
-  if (rename(fb1->name, outname) < 0)
-    die("rename(%s,%s): %m", fb1->name, outname);
-  bclose(fb1);
+  bfix_tmp_file(fb1, outname);
 #endif
 }
 
index d17f4197d89177f22f4be41971ce3f215306323e..e329fa29447385c3e14269f470b9a26a43584f13 100644 (file)
@@ -272,10 +272,7 @@ static struct fastbuf *P(sort)(
   sorter_run(&ctx);
 
 #ifdef SORT_OUTPUT_FILE
-  if (rename(ctx.out_fb->name, out) < 0)
-    die("Cannot rename %s to %s: %m", ctx.out_fb->name, out);
-  bconfig(ctx.out_fb, BCONFIG_IS_TEMP_FILE, 0);
-  bclose(ctx.out_fb);
+  bfix_tmp_file(ctx.out_fb, out);
   ctx.out_fb = NULL;
 #endif
   return ctx.out_fb;