coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tail: ensure -f --retry 'missing' handles truncation


From: Jim Meyering
Subject: Re: [PATCH] tail: ensure -f --retry 'missing' handles truncation
Date: Wed, 9 Nov 2016 13:31:41 -0800

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]