From nobody Sun Jul 28 15:02:52 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 4WX4VN3Ll3z5SK6j; Sun, 28 Jul 2024 15:02:52 +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 4WX4VN2mp8z4fY6; Sun, 28 Jul 2024 15:02:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722178972; 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=+hBVq3dIAhG3JGArXVkFxdPT0I/Msw38i86UlIX9mfk=; b=lbGbbuJdI25+Vr7Jvq0h+SpDrw8plbw3y2xTMRtNZVwX6uJtjbmD1PQm4yMezfsnY89v+G GCaqGm154gclmFDDUPAZ9x1qNwdLQDVz0H4a3gYUpgbTBEIt3gurv9WdQkMp/6K2EzbQlj Gh1YUe6/WIA3WU0vvRmjYijtbw9B3XXlloaJn+f/KSGV6LaOnGBbjlphqjD7mC4pcB7/sv TUItvUr9uEHzmLhZoGxI8Dr4eyn/NXtFO+ci3Txp+cyI0yks9kQOSxebAIWLLNqktGUp4C zCKqUIAms404UWW72vZjeWJ1dHOFlc7oziRgq7YXorB0fAhD9TppkXrdiTBg+w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722178972; a=rsa-sha256; cv=none; b=SFLERn36E6wvhwlszHMTBzp3AwENAaV5IHQPNHXrgI/2otB4NESATlS1OaUZN6hlWiOZ+G v9KqUazJEBeLWM7UW6nca14Wt5W6oIy5KhdurZhaAGbE01+fKlWFKMbf4G/X315CwmT8y3 8U0XOoYJf2YgXPMZNYiG07DHDfcG7L0W3xrF//K3X8mVvWzDZG14ckFI5kaDwODKVc4zNu Ie0ZvLqEHl8+AERl1HbwNBSG+0fFZaQHGXGUCFOmmugZr5NV8fEzP3xdq1YwqnPhmBVl9K EjcjvsZB73OlGlkyOkpVmi8ME+03TkdkFSHIMXnQr8wWC/yjPc0Mqyn2iqf9lg== 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=1722178972; 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=+hBVq3dIAhG3JGArXVkFxdPT0I/Msw38i86UlIX9mfk=; b=rcd7jI+ao2dnKJZ1YoMs76+aiSNeGg8qAarGYNWhbCCCxSRiiIuaU6gNHDh7h67Dp4xhz6 n8jQ+BIrPeC7Zb+sjm4l36pvo/c0vl8dBSX0C06Kyn9JN6+j3y/Q/KtLLE7u/XAoFNhD8J wtRNijnMW+3G0cEwcDeR6rKLX9DV/9J/aV6TZFC4slj2Z8by/l+PO6Aoo/28R0ZW+EQ5oC 4jCySNNOXvq1cbR7QvY3mGYwLKIsK6ZXhMAh8imz66hvUhumyUjmiOsJ1jvecYYKcAB+dj VDBlAaEjt0DFwqnzMVKQAv1quRrJajVxrJftyz408kORXgLbbSAGoZ8XtshngQ== 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 4WX4VN2Gvpzvwg; Sun, 28 Jul 2024 15:02:52 +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 46SF2qn7008550; Sun, 28 Jul 2024 15:02:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46SF2qVV008547; Sun, 28 Jul 2024 15:02:52 GMT (envelope-from git) Date: Sun, 28 Jul 2024 15:02:52 GMT Message-Id: <202407281502.46SF2qVV008547@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: 7d1e4b7bf299 - stable/14 - sockstat(1): tolerate situation where file info cannot be fetched 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: 7d1e4b7bf299dbf2319c969357cd1545ad81c8a6 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7d1e4b7bf299dbf2319c969357cd1545ad81c8a6 commit 7d1e4b7bf299dbf2319c969357cd1545ad81c8a6 Author: Konstantin Belousov AuthorDate: 2024-07-20 00:30:55 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-28 15:02:45 +0000 sockstat(1): tolerate situation where file info cannot be fetched PR: 279875 (cherry picked from commit 35f4984343229545881a324a00cdbb3980d675ce) --- usr.bin/sockstat/sockstat.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c index 52c494f03045..56f107b5cdaf 100644 --- a/usr.bin/sockstat/sockstat.c +++ b/usr.bin/sockstat/sockstat.c @@ -1165,8 +1165,11 @@ displaysock(struct sock *s, int pos) f = RB_FIND(files_t, &ftree, &(struct file){ .xf_data = p->socket }); - pos += xprintf("[%lu %d]", - (u_long)f->xf_pid, f->xf_fd); + if (f != NULL) { + pos += xprintf("[%lu %d]", + (u_long)f->xf_pid, + f->xf_fd); + } } else pos += printaddr(&p->laddr->address); } @@ -1184,9 +1187,12 @@ displaysock(struct sock *s, int pos) f = RB_FIND(files_t, &ftree, &(struct file){ .xf_data = p->socket }); - pos += xprintf("%s[%lu %d]", - fref ? "" : ",", - (u_long)f->xf_pid, f->xf_fd); + if (f != NULL) { + pos += xprintf("%s[%lu %d]", + fref ? "" : ",", + (u_long)f->xf_pid, + f->xf_fd); + } ref = p->faddr->nextref; fref = false; }