From 9c52662e249189f7beec9319a3c8cd2847eeb242 Mon Sep 17 00:00:00 2001 From: jdolecek Date: Tue, 20 Feb 2001 18:33:09 +0000 Subject: [PATCH] fsort(): don't call append() with zero nelem This fixes the 'sort -f /dev/null' coredump reported on current-users. --- usr.bin/sort/fsort.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/usr.bin/sort/fsort.c b/usr.bin/sort/fsort.c index 35ed9cb33bb8..56c6f9298744 100644 --- a/usr.bin/sort/fsort.c +++ b/usr.bin/sort/fsort.c @@ -1,4 +1,4 @@ -/* $NetBSD: fsort.c,v 1.16 2001/02/19 20:50:17 jdolecek Exp $ */ +/* $NetBSD: fsort.c,v 1.17 2001/02/20 18:33:09 jdolecek Exp $ */ /*- * Copyright (c) 1993 @@ -47,7 +47,7 @@ #include "fsort.h" #ifndef lint -__RCSID("$NetBSD: fsort.c,v 1.16 2001/02/19 20:50:17 jdolecek Exp $"); +__RCSID("$NetBSD: fsort.c,v 1.17 2001/02/20 18:33:09 jdolecek Exp $"); __SCCSID("@(#)fsort.c 8.1 (Berkeley) 6/6/93"); #endif /* not lint */ @@ -211,7 +211,8 @@ fsort(binno, depth, top, filelist, nfiles, outfp, ftbl) ? sradixsort(keylist, nelem, weights, REC_D) : 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) {