MFC rev. 1.17: do not warn if the process exits before we get its name.

This commit is contained in:
maxim 2007-06-23 06:22:24 +00:00
parent bd35295c7c
commit b3c9d0fb6d

View File

@ -456,7 +456,9 @@ getprocname(pid_t pid)
mib[3] = (int)pid; mib[3] = (int)pid;
len = sizeof proc; len = sizeof proc;
if (sysctl(mib, 4, &proc, &len, NULL, 0) == -1) { 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 ("??");
} }
return (proc.ki_ocomm); return (proc.ki_ocomm);