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)