On Wed, Nov 9, 2016 at 9:57 AM, Pádraig Brady <address@hidden> wrote:
> * src/tail.c (tail_forever): The BLOCKING optimization is only
> enabled for non regular files (which can't be truncated), so ensure
> we don't enable that unless we've a valid st_mode.
> * tests/tail-2/retry.sh: Add a test case.
> * NEWS: Mention the bug fix.
...
> /* Use blocking I/O as an optimization, when it's easy. */
> bool blocking = (pid == 0 && follow_mode == Follow_descriptor
> - && n_files == 1 && ! S_ISREG (f[0].mode));
> + && n_files == 1 && f[0].fd != -1 && ! S_ISREG
> (f[0].mode));
Thanks for the fix and added tests. They look fine.
Only suggestion would be to mention in the log that the fix (making
the existing "! S_ISREG(mode)" check work as intended) is to ensure
that "mode" is from a valid file descriptor.