diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c index c5d6067ef879..8c29843670a8 100644 --- a/usr.bin/sockstat/sockstat.c +++ b/usr.bin/sockstat/sockstat.c @@ -526,7 +526,9 @@ getprocname(pid_t pid) mib[3] = (int)pid; len = sizeof proc; if (sysctl(mib, 4, &proc, &len, NULL, 0) == -1) { - warn("sysctl()"); + /* Do not warn if the process exits before we get its name. */ + if (errno != ESRCH) + warn("sysctl()"); return ("??"); } return (proc.ki_comm);