Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/sort Don't give merge an empty file when we detect E...



details:   https://anonhg.NetBSD.org/src/rev/0bb1b631e579
branches:  trunk
changeset: 748023:0bb1b631e579
user:      dsl <dsl%NetBSD.org@localhost>
date:      Fri Oct 09 20:23:19 2009 +0000

description:
Don't give merge an empty file when we detect EOF with nothing in our
buffer.

diffstat:

 usr.bin/sort/fsort.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r aa070b35a729 -r 0bb1b631e579 usr.bin/sort/fsort.c
--- a/usr.bin/sort/fsort.c      Fri Oct 09 20:19:44 2009 +0000
+++ b/usr.bin/sort/fsort.c      Fri Oct 09 20:23:19 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fsort.c,v 1.43 2009/09/28 20:30:01 dsl Exp $   */
+/*     $NetBSD: fsort.c,v 1.44 2009/10/09 20:23:19 dsl Exp $   */
 
 /*-
  * Copyright (c) 2000-2003 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
 #include "fsort.h"
 
 #ifndef lint
-__RCSID("$NetBSD: fsort.c,v 1.43 2009/09/28 20:30:01 dsl Exp $");
+__RCSID("$NetBSD: fsort.c,v 1.44 2009/10/09 20:23:19 dsl Exp $");
 __SCCSID("@(#)fsort.c  8.1 (Berkeley) 6/6/93");
 #endif /* not lint */
 
@@ -182,9 +182,11 @@
                }
 
                /* Save current data to a temporary file for a later merge */
-               tmp_fp = ftmp();
-               append(keylist, nelem, tmp_fp, putrec);
-               save_for_merge(tmp_fp, geteasy, ftbl);
+               if (nelem != 0) {
+                       tmp_fp = ftmp();
+                       append(keylist, nelem, tmp_fp, putrec);
+                       save_for_merge(tmp_fp, geteasy, ftbl);
+               }
                mfct = 1;
 
                if (c == EOF) {



Home | Main Index | Thread Index | Old Index