diff options
author | iedowse <iedowse@FreeBSD.org> | 2005-03-20 22:08:52 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2005-03-20 22:08:52 +0000 |
commit | 316bdea082c8a6feacb00ef9fd22e27247eb4cbd (patch) | |
tree | 0126f671e21055d01c0685dfacc8a96e65be9581 /usr.bin/tail | |
parent | c24d32c62d679248ab249e702db03abd3ff41642 (diff) | |
download | FreeBSD-src-316bdea082c8a6feacb00ef9fd22e27247eb4cbd.zip FreeBSD-src-316bdea082c8a6feacb00ef9fd22e27247eb4cbd.tar.gz |
Don't skip the initialisation of tl->len when we hit an EOF immediately
after allocating a new buffer. This bug caused `tail -r < /dev/null'
to core dump when the `J' malloc option is set, and also affected
any other input that was an exact multiple of 128k.
Diffstat (limited to 'usr.bin/tail')
-rw-r--r-- | usr.bin/tail/reverse.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/usr.bin/tail/reverse.c b/usr.bin/tail/reverse.c index ea2ed70..f0a52aa 100644 --- a/usr.bin/tail/reverse.c +++ b/usr.bin/tail/reverse.c @@ -234,9 +234,8 @@ r_buf(FILE *fp) * If no input data for this block and we tossed some data, * recover it. */ - if (!len) { - if (enomem) - enomem -= tl->len; + if (!len && enomem) { + enomem -= tl->len; tl = tl->prev; break; } |