From nobody Wed Aug 21 16:00:03 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 4WprdH3SxYz5V5WN; Wed, 21 Aug 2024 16:00:03 +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 4WprdH2kK5z4VC0; Wed, 21 Aug 2024 16:00:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724256003; 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=lr/YHBXWWY3CqqevT6xs5BzBS15FYM6U9DzD0JoUC/A=; b=uHJ+K01eYHFaZdKfibDKCbU4w7RT7V8LrGZa4Oqv6cnBPNilVPgBAB89s0wRFtEfNs4/E5 oSE9aG0N5JrKkQyLbiyVJ9Ob51F7Y6RipNM7xEkSGD+tlsohdpT2ZbONEb2QzMX1bPsHBu HQvDCHRPZQVRq8zQ83gN5R/F0+7FLAXvFrNYOs6hGknH75+iTTC4bEtb6b1Ckn1WZG77g/ Ke4XIUEmV7pQjBDfLTpUEXWEQXG7H5qUTdvDAAVnQSXLpSWVZwTIlZSfvR59+Ee1yA9vXJ w08OST5j0jCuYq7+u4+X6W2b7H6as4mm6jBq6PllKVHH03HgI42nCCTed1TyaA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724256003; a=rsa-sha256; cv=none; b=RVRcez80y+Wle+w7RNPR1L8NDK0VDwHjWbh981mrk9IQIIgh8DaxDyalz6+SK2kO/QGJwh Zep7Rv1GeaQU83uwLq8RavvdJeZQys+9di2xXg3CnB7ArNvVLr83AHEMVHXLsGmsol02q0 6wttF0F3tHrVoMW/24uq9R2MxGDCscKNFwcw+fwxSoN+68yrHsia+r+u8Ahq9LMkclOlgv ccmviGFwVs0Bv9J5xXIWVeXIlWhQuToNnrrdx4OhMCjkP52x5q0XgxUhuTZyivYMQyeJU2 AZyGZ65irIrWFvTuRiJO1+DtWDIOLxlnsz90eXuiID8P4+B2/dPwGMOMBmFeYA== 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=1724256003; 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=lr/YHBXWWY3CqqevT6xs5BzBS15FYM6U9DzD0JoUC/A=; b=Hgv1c/8ANF+fotD8a5z2ZG+Wr7vzs7IRxItLTBnm3NTHhhiFAQy6JvZiiEttlpRo9l1QqT j7mZnwYED+Z9EYQLqqDDcExgrboJpnUsB8F4aKa68/8349gaHuAeZXFFVyYvKoNiI+He9c O+OKm1e7PWCgvlLFyFBY8GnQR1N41vH1OpwrcQVo8IMLFNWOR7hH28YFTMto9N0WMJ1A8R MU/alJhUH+aEadN5ac+3BKxL3RUimkF9jTQgfXrXYkKbSYXSJEIjS3a4Ya2KedOj1EdLHn bLChsCmoZA9yI/NfEXNFa/rz2/w5syeFP+3ti/ZVpvRRcnIfXVx41tpklCH5Og== 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 4WprdH2F9rzqps; Wed, 21 Aug 2024 16:00:03 +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 47LG03xq024279; Wed, 21 Aug 2024 16:00:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47LG03P5024271; Wed, 21 Aug 2024 16:00:03 GMT (envelope-from git) Date: Wed, 21 Aug 2024 16:00:03 GMT Message-Id: <202408211600.47LG03P5024271@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: 9b945635c147 - releng/13.4 - 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/releng/13.4 X-Git-Reftype: branch X-Git-Commit: 9b945635c147feb4ac6ebf84bd19e149e9a10227 Auto-Submitted: auto-generated The branch releng/13.4 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9b945635c147feb4ac6ebf84bd19e149e9a10227 commit 9b945635c147feb4ac6ebf84bd19e149e9a10227 Author: Andre Albsmeier AuthorDate: 2024-08-19 07:54:24 +0000 Commit: Konstantin Belousov CommitDate: 2024-08-21 15:59:21 +0000 tail -F: fix crash PR: 280910 Approved by: re (cperciva) (cherry picked from commit 308399a179a49b7b858c725de10177fdb0502fd2) (cherry picked from commit 8dfa4e5b6ce2e22ef92c0ec13aa001994774c23f) --- 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));