From nobody Tue Jan 11 18:15:01 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 565BE193F138; Tue, 11 Jan 2022 18:15:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JYJks2jrwz4RBV; Tue, 11 Jan 2022 18:15:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2AD971DF9F; Tue, 11 Jan 2022 18:15:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20BIF1Vo099978; Tue, 11 Jan 2022 18:15:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20BIF1Uj099977; Tue, 11 Jan 2022 18:15:01 GMT (envelope-from git) Date: Tue, 11 Jan 2022 18:15:01 GMT Message-Id: <202201111815.20BIF1Uj099977@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 60cacd2e41e1 - releng/13.0 - tail: fix "tail -F" file rotation detection List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 60cacd2e41e17aeaf7dcbdfe4057028a5b8b9d1a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641924901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2y40icmj4ymMpWUZ+22UMbEkJISLcm7sYaTzO6VQp74=; b=B5iH+xKQPu3K3nZ1uugofj9vTjyydiZ0Uw7NBEwU/QooclAwKuIxBiWHsv7EabpJznggCE zkjpXIUAMNOiT69VippOnrkQ8/Z27ErxURuE9PPw/yskI1749aYTUC5np3ZGhlHegbel43 h7JV3qCv2wWAONe/ZQvM8+pjHRMNt9+tFyoJiz3pCGKsFbmaB9ok2aUpbEHT6mrcwEZKgR lJu4TcPEGzKT83sYYPSjp/KLTgKoqJ/x+JZElXH9MiM03e06NuQ9N5KQOdYrkiTnBWZpKf dhwB3pJ4iXnPd1Pf5wjlS8qc0dAhz4I1fAx5A5QyhSp2MKjfgmOOK6TfKSitzw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641924901; a=rsa-sha256; cv=none; b=yGi3Rc7tCc4DYmmmVnARcUPQhos/YIZOk3mawexCbFJoSeEnGvN/pNuAlimifN/+x0lRyk uqcM0aXvAK/XxzLV5RV7+6zamX4RotKbUp5RU485BwqbA2em2hvffck53SbOMuy9YJRjGZ TOWztTSpbGP5z+2z+rnzdFqNPluDHp0RTEAg5P8W7WXWrJvzI0oVhuKKFT1BFIcEUiSy3H Z802usKHb07OUFzlQBM4Nd1COfMp+MYB8c8btvB2lFw4mtQCz1cJlBU7j+5R1vXvqj4eTs bg4FOSX7eiTX8Ysn15w5Xs1+VpzUMpicjCm9E/DsOBEm9g6RqhzW4nKnXAVYYA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.0 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=60cacd2e41e17aeaf7dcbdfe4057028a5b8b9d1a commit 60cacd2e41e17aeaf7dcbdfe4057028a5b8b9d1a Author: Chuck Silvers AuthorDate: 2021-02-02 00:21:14 +0000 Commit: Ed Maste CommitDate: 2022-01-10 14:51:54 +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 (cherry picked from commit 7787e7eed9d2a43fb6eb66666040f1b495995a2f) (cherry picked from commit 8c59e863e2c03c3b4ab2c403243561a4cc4fcb10) Approved by: so Errata: FreeBSD-EN-22:05.tail --- 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);