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.
This commit is contained in:
Ian Dowse 2005-03-20 22:08:52 +00:00
parent c1249c6338
commit 2bcccc224c

View File

@ -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;
}