From nobody Wed Aug 21 10:33:25 2024 X-Original-To: dev-commits-src-all@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 4WpjNP3Yt0z5Tf3S; Wed, 21 Aug 2024 10:33:25 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WpjNP2JZ1z4pKx; Wed, 21 Aug 2024 10:33:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724236405; 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=PRHZsDlU3fIe2JUa2DJEKIywFc0aqRef2w15bp7tSwA=; b=rl2kOeDAkawkgqbUPMyMq2SD3J5/9vUbvMwVuLEQkWv/LLp/OlswqHD+EQhGQD8kfOYHq+ JFvxToHWJhWLLXI0KrFNsJ92nt9eJDieZnsRnT7mdFcTdk+TSTz/ptWNPOnUX8UgY9pfGQ 7TT4woGu8GLodlSjKsNG2mk05y1TXpJQilhyKf7ZUHjQz66xf/G6OYCbHu8tubz1+3d6fM r5yvVyRRIXp7Y10YX1uxKBot51j5t9bfFRvH2PGJqVm5ad8dBlKETaDnRnNvpKvxIf9rvJ KzcGBSLyMIXPK2YK4pnF5GHegrscGHMiyO9wp8lB9pGEKtHk7ohujShTgnGAaQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724236405; a=rsa-sha256; cv=none; b=JEBq/W80Xde190wTinF4N5qkOW/I4rGY+iTbMhvlz7YeeOgGsMZ6GwlPpltUEx3qFF68Od Px8fAhDZ3inzPgxX+/5i4KbVvAGTyO28uTh1hrVCF+vhJ8vEdrr1D+v+9ne3bLPx+iXJyb ugJ5by2BIgzOod4zTzzDfybWTZI5pXvRg1rime6xneYEExF32Z/XCfr4g5p5zhyATP8od6 tXwKCe6X/QFdJ1EgIElEjCBDcqwuUzfip7E2MGozCCfZ8DOjeoKALukZNhxBr75+R2LCgC H535p6GYr4SMvUW/z4xRKtR6IVMJyWk9IYz9USIlPIdhTNt/OMnulBcx1+5gPQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724236405; 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=PRHZsDlU3fIe2JUa2DJEKIywFc0aqRef2w15bp7tSwA=; b=CTjshnqgy5shh2DvIJamFycHk7+dY98IyQCbBWVwRsnPAS/rw6E7M6str7s3mxmBmaUD0L J4ZR0B/Yof3S0NR/VatkAeCznUSYg6YDJUHslSeQ+3t+gs1qTg74q4t+gYoWOXDaS9K3AE lkRhigqCNXlspfPLpp+ewVJRWJmuJHnYD/Wr216kMRLgHFfeOmgnRoqfoLmwKyXfCuzDOp mBp0og/2BckaWmiOfJ0lWg6bDZ4Fl7y+k1TLC8mnITYOiPj4D3Ls7R7NPDa5gVZHA2MhP+ vY8wGZVkDViGR4TvNZ/uImoXxbMeEE4SzLqMa72o+HXLCgebzcv+zDOHAOB31Q== 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 4WpjNP1wF2zgpG; Wed, 21 Aug 2024 10:33:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 47LAXPrg078505; Wed, 21 Aug 2024 10:33:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47LAXP3I078502; Wed, 21 Aug 2024 10:33:25 GMT (envelope-from git) Date: Wed, 21 Aug 2024 10:33:25 GMT Message-Id: <202408211033.47LAXP3I078502@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: cf4a34bbc7df - stable/14 - tail -F: fix crash List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: cf4a34bbc7dfee43e9983a847ecf0fa0ed1d258d Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cf4a34bbc7dfee43e9983a847ecf0fa0ed1d258d commit cf4a34bbc7dfee43e9983a847ecf0fa0ed1d258d Author: Andre Albsmeier AuthorDate: 2024-08-19 07:54:24 +0000 Commit: Konstantin Belousov CommitDate: 2024-08-21 10:32:49 +0000 tail -F: fix crash PR: 280910 (cherry picked from commit 308399a179a49b7b858c725de10177fdb0502fd2) --- usr.bin/tail/forward.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.bin/tail/forward.c b/usr.bin/tail/forward.c index a902e006afed..2edf8730e8b1 100644 --- a/usr.bin/tail/forward.c +++ b/usr.bin/tail/forward.c @@ -382,7 +382,8 @@ follow(file_info_t *files, enum STYLE style, off_t off) sb2.st_dev != file->st.st_dev || sb2.st_nlink == 0) { show(file); - fclose(file->fp); + if (file->fp != NULL) + fclose(file->fp); file->fp = ftmp; memcpy(&file->st, &sb2, sizeof(struct stat));