Date: Sun, 28 Jul 2024 15:02:52 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 7d1e4b7bf299 - stable/14 - sockstat(1): tolerate situation where file info cannot be fetched Message-ID: <202407281502.46SF2qVV008547@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7d1e4b7bf299dbf2319c969357cd1545ad81c8a6 commit 7d1e4b7bf299dbf2319c969357cd1545ad81c8a6 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-07-20 00:30:55 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> 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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407281502.46SF2qVV008547>