Subject: Re: PR: bin/12138 [Was: sort crashes]
To: Jun-ichiro itojun Hagino <itojun@iijlab.net>
From: Jaromír <jdolecek@netbsd.org>
List: current-users
Date: 02/15/2001 20:24:56
I think the right thing is to not call the append() function at all
if there are no elements to output (nelem == 0). The problem itself
is in macro OUTPUT in append.c, which just think it's always called
with at least one record to print.
So, I believe this is 'correct' fix.
Jaromir
Index: fsort.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/sort/fsort.c,v
retrieving revision 1.12
diff -u -p -r1.12 fsort.c
--- fsort.c 2001/02/05 14:25:34 1.12
+++ fsort.c 2001/02/15 19:26:41
@@ -209,7 +209,8 @@ fsort(binno, depth, top, filelist, nfile
: radixsort(keylist, nelem, weights, REC_D) )
err(2, NULL);
}
- append(keylist, nelem, depth, outfp, putline, ftbl);
+ if (nelem > 0)
+ append(keylist, nelem, depth, outfp, putline, ftbl);
break; /* pop */
}
if (panic >= PANIC) {
--
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.ics.muni.cz/~dolecek/
@@@@ Wanna a real operating system ? Go and get NetBSD, dammit! @@@@