diff options
author | Tim J. Robbins <tjr@FreeBSD.org> | 2002-05-16 05:04:26 +0000 |
---|---|---|
committer | Tim J. Robbins <tjr@FreeBSD.org> | 2002-05-16 05:04:26 +0000 |
commit | 248602a1b243fda3594e053fbe40a43166adf0b0 (patch) | |
tree | e9b05baa637c98745a53396ec0b63fcc36f3f6e5 /usr.bin/csplit | |
parent | 9b517597076ab65d7cc426faedc1694f0fa0fe90 (diff) | |
download | src-248602a1b243fda3594e053fbe40a43166adf0b0.tar.gz src-248602a1b243fda3594e053fbe40a43166adf0b0.zip |
Handle the case where a negative offset in a regular expression match
is larger than the number of lines in the overflow file.
Notes
Notes:
svn path=/head/; revision=96710
Diffstat (limited to 'usr.bin/csplit')
-rw-r--r-- | usr.bin/csplit/csplit.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.bin/csplit/csplit.c b/usr.bin/csplit/csplit.c index 35692cc290ae..f54a489937a5 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); |