From b4eb37c63d451da48d782e4f68cf73377650466f Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Sat, 19 Jul 2003 06:23:56 +0000 Subject: [PATCH] make sockstat not print wierd addresses on not connected unix domain sockets Pointed out by: rwatson Reviewed by: peter --- usr.bin/sockstat/sockstat.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c index b68906e5172..eaeb24291e7 100644 --- a/usr.bin/sockstat/sockstat.c +++ b/usr.bin/sockstat/sockstat.c @@ -540,8 +540,12 @@ display(void) break; } /* client */ - pos += xprintf("-> "); p = *(void **)&s->faddr; + if (p == NULL) { + pos += xprintf("(not connected)"); + break; + } + pos += xprintf("-> "); for (hash = 0; hash < HASHSIZE; ++hash) { for (s = sockhash[hash]; s != NULL; s = s->next) if (s->pcb == p)