]> git.ipfire.org Git - thirdparty/coreutils.git/commit
tail: refactor to skip stat call on failure
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 29 Jul 2025 15:24:58 +0000 (08:24 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 4 Aug 2025 02:48:05 +0000 (19:48 -0700)
commit09fc945b374d256869615591171d744462e20c6e
tree20724bc62aaad4d1bc198d276ede017f13a17de3
parentd58aa27d067aec2044d3ddd69e35bdefc859b0d9
tail: refactor to skip stat call on failure

* src/tail.c (tail_bytes): New function.
(tail_bytes, tail_lines, tail): Accept struct stat pointer from
caller instead of calling fstat ourselves.  All callers changed.
(tail_file): Skip a call to fstat if fstat already failed.
* tests/tail/follow-stdin.sh: Adjust to match new behavior
on failure, which omits a redundant diagnostic.
src/tail.c
tests/tail/follow-stdin.sh