From 054f70b470751d5cb9034aa91797a323d497516c Mon Sep 17 00:00:00 2001 From: tjr Date: Thu, 16 May 2002 05:04:26 +0000 Subject: [PATCH] Handle the case where a negative offset in a regular expression match is larger than the number of lines in the overflow file. --- usr.bin/csplit/csplit.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.bin/csplit/csplit.c b/usr.bin/csplit/csplit.c index 35692cc290a..f54a489937a 100644 --- a/usr.bin/csplit/csplit.c +++ b/usr.bin/csplit/csplit.c @@ -325,6 +325,8 @@ toomuch(FILE *ofp, long n) for (i = 1; i <= nread; i++) if (buf[nread - i] == '\n' && n-- == 0) break; + if (ftello(ofp) == 0) + break; } while (n > 0); if (fseek(ofp, nread - i + 1, SEEK_CUR) != 0) err(1, "%s", currfile); -- 2.45.2