summaryrefslogtreecommitdiffstats
path: root/usr.bin/sockstat/sockstat.c
diff options
context:
space:
mode:
authorroam <roam@FreeBSD.org>2004-08-25 16:36:17 +0000
committerroam <roam@FreeBSD.org>2004-08-25 16:36:17 +0000
commit47b3e1d3042baf9e39e847f7c40472f5640a1dd4 (patch)
treeacbbe7beb5f6a37a9ee4395562d3d9f6ca87db56 /usr.bin/sockstat/sockstat.c
parent17cdeacd68484d9612c250ef9e82250180cbd458 (diff)
downloadFreeBSD-src-47b3e1d3042baf9e39e847f7c40472f5640a1dd4.zip
FreeBSD-src-47b3e1d3042baf9e39e847f7c40472f5640a1dd4.tar.gz
Do not display bogus entries for sockets in the TIME_WAIT or similar
states that no longer have a corresponding file descriptor - until now, sockstat would mostly randomly match null kern.file.*.xf_data fields with the first mostly-closed socket. This bugfix is a RELENG_5 candidate. Approved by: andre
Diffstat (limited to 'usr.bin/sockstat/sockstat.c')
-rw-r--r--usr.bin/sockstat/sockstat.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c
index eaeb242..acb9182 100644
--- a/usr.bin/sockstat/sockstat.c
+++ b/usr.bin/sockstat/sockstat.c
@@ -494,6 +494,8 @@ display(void)
"LOCAL ADDRESS", "FOREIGN ADDRESS");
setpassent(1);
for (xf = xfiles, n = 0; n < nxfiles; ++n, ++xf) {
+ if (xf->xf_data == NULL)
+ continue;
hash = (int)((uintptr_t)xf->xf_data % HASHSIZE);
for (s = sockhash[hash]; s != NULL; s = s->next)
if ((void *)s->socket == xf->xf_data)
OpenPOWER on IntegriCloud