summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaxim <maxim@FreeBSD.org>2007-06-16 20:24:55 +0000
committermaxim <maxim@FreeBSD.org>2007-06-16 20:24:55 +0000
commit8ea5048f0d24b262226b21eba075ea19f648ed9c (patch)
treee3fa837536703d23ce741f8febff61a041b6c80b
parentd89e4233376cf1d1117c605c4af148ce0910e59d (diff)
downloadFreeBSD-src-8ea5048f0d24b262226b21eba075ea19f648ed9c.zip
FreeBSD-src-8ea5048f0d24b262226b21eba075ea19f648ed9c.tar.gz
o Do not warn if the process exits before we get its name.
PR: bin/113777 Submitted by: Dmitrij Tejblum MFC after: 1 week
-rw-r--r--usr.bin/sockstat/sockstat.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c
index c5d6067..8c29843 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);
OpenPOWER on IntegriCloud