mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
tail: optimize tail -n +2**63
* src/tail.c (tail_lines): Also optimize ‘tail -n +N’ on a seekable file, where OFF_T_MAX <= N < UINTMAX_MAX. Of course this is very unlikely.
This commit is contained in:
1 parent
3918655d4b
commit
10aa908ebd
1 file changed
+1
-1
+1
-1
@@ -1955,7 +1955,7 @@ tail_lines (char const *pretty_filename, int fd, struct stat const *st,
|
||||
{
|
||||
/* If skipping all input use lseek if possible, for speed. */
|
||||
off_t pos;
|
||||
if (n_lines == UINTMAX_MAX && 0 <= (pos = lseek (fd, 0, SEEK_END)))
|
||||
if (OFF_T_MAX <= n_lines && 0 <= (pos = lseek (fd, 0, SEEK_END)))
|
||||
*read_pos = pos;
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user