diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c index 3aa3e0d3f858..9b63a1ca2fbd 100644 --- a/usr.bin/sockstat/sockstat.c +++ b/usr.bin/sockstat/sockstat.c @@ -456,7 +456,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_ocomm);