MFC rev. 1.17: do not warn if the process exits before we get its name.
This commit is contained in:
parent
bd35295c7c
commit
b3c9d0fb6d
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user