Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Feb 2021 00:28:51 GMT
From:      Chuck Silvers <chs@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 7787e7eed9d2 - main - tail: fix "tail -F" file rotation detection
Message-ID:  <202102020028.1120Spr5014478@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by chs:

URL: https://cgit.FreeBSD.org/src/commit/?id=7787e7eed9d2a43fb6eb66666040f1b495995a2f

commit 7787e7eed9d2a43fb6eb66666040f1b495995a2f
Author:     Chuck Silvers <chs@FreeBSD.org>
AuthorDate: 2021-02-02 00:21:14 +0000
Commit:     Chuck Silvers <chs@FreeBSD.org>
CommitDate: 2021-02-02 00:21:14 +0000

    tail: fix "tail -F" file rotation detection
    
    When checking if the newly opened file is the same as the old one,
    we need to fstat() the new file descriptor, not the old one again.
    
    Reviewed by:    glebius
    Sponsored by:   Netflix
---
 usr.bin/tail/forward.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.bin/tail/forward.c b/usr.bin/tail/forward.c
index 2888bd18816e..878cb5a4550b 100644
--- a/usr.bin/tail/forward.c
+++ b/usr.bin/tail/forward.c
@@ -367,7 +367,7 @@ follow(file_info_t *files, enum STYLE style, off_t off)
 					continue;
 				ftmp = fileargs_fopen(fa, file->file_name, "r");
 				if (ftmp == NULL ||
-				    fstat(fileno(file->fp), &sb2) == -1) {
+				    fstat(fileno(ftmp), &sb2) == -1) {
 					if (errno != ENOENT)
 						ierr(file->file_name);
 					show(file);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102020028.1120Spr5014478>