Paul Eggert <[EMAIL PROTECTED]> wrote:
> Andreas Schwab <[EMAIL PROTECTED]> writes:
>
>> tail crashes on read failures, like trying to read from a directory.
>> head has the same bug, but it is harder to trigger.
>
> Thanks for catching that. Here's a proposed improvement on your
> patch, which avoids an unnecessary assignment to tmp->nbytes.
Thanks for the clean-up, but isn't that assignment to tmp->nbytes
necessary. There are uses after the main while loop, and I seem to
recall wanting to make the same change but not being able to.
...
> @@ -496,9 +494,10 @@ elide_tail_lines_pipe (const char *filen
> n_elide newlines, or until EOF, whichever comes first. */
> while (1)
> {
> - n_read = tmp->nbytes = safe_read (fd, tmp->buffer, BUFSIZ);
> + n_read = safe_read (fd, tmp->buffer, BUFSIZ);
> if (n_read == 0 || n_read == SAFE_READ_ERROR)
> break;
> + tmp->nbytes = n_read;
> tmp->nlines = 0;
> tmp->next = NULL;
>
_______________________________________________
Bug-coreutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-coreutils