From: millert Date: Thu, 8 Jul 2021 00:38:42 +0000 (+0000) Subject: csplit(1): Fix extraneous output in edge case X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=82c893686e8f24841a21b7859da5ed39f6775e2a;p=openbsd csplit(1): Fix extraneous output in edge case When the input to csplit contains fewer lines than the number of matches specified, extra output was mistakenly included in some output files. From FreeBSD via Tim Chase. --- diff --git a/usr.bin/csplit/csplit.c b/usr.bin/csplit/csplit.c index e32c044bc00..45b0e7747f5 100644 --- a/usr.bin/csplit/csplit.c +++ b/usr.bin/csplit/csplit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: csplit.c,v 1.9 2016/10/28 07:22:59 schwarze Exp $ */ +/* $OpenBSD: csplit.c,v 1.10 2021/07/08 00:38:42 millert Exp $ */ /* $FreeBSD: src/usr.bin/csplit/csplit.c,v 1.9 2004/03/22 11:15:03 tjr Exp $ */ /*- @@ -398,8 +398,10 @@ do_rexp(const char *expr) first = 0; } - if (p == NULL) + if (p == NULL) { + toomuch(NULL, 0); errx(1, "%s: no match", re); + } if (ofs <= 0) { /*