diff options
author | Simon Sigurdhsson <Sigurdhsson@gmail.com> | 2012-07-04 14:10:44 +0200 |
---|---|---|
committer | Simon Sigurdhsson <Sigurdhsson@gmail.com> | 2012-07-04 14:10:44 +0200 |
commit | 223bbb82c94a9f21afbb79ea3e6eb5800d87b03d (patch) | |
tree | 06a646cabc05eb4d0a02a7f92b423e7043a12427 | |
parent | 9032acb2f9d690c3023357895fee77559e587c1f (diff) | |
download | cpulimit-223bbb82c94a9f21afbb79ea3e6eb5800d87b03d.tar.gz |
Silence EPERM and ESRCH errors in get_process_pti
-rw-r--r-- | src/process_iterator_apple.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/process_iterator_apple.c b/src/process_iterator_apple.c index 2270ad6..98af1aa 100644 --- a/src/process_iterator_apple.c +++ b/src/process_iterator_apple.c @@ -57,7 +57,9 @@ static int get_process_pti(pid_t pid, struct proc_taskallinfo *ti) { int bytes; bytes = proc_pidinfo(pid, PROC_PIDTASKALLINFO, 0, ti, sizeof(*ti)); if (bytes <= 0) { - fprintf(stderr, "proc_pidinfo: %s\n", strerror(errno)); + if (!(errno & (EPERM | ESRCH))) { + fprintf(stderr, "proc_pidinfo: %s\n", strerror(errno)); + } return -1; } else if (bytes < sizeof(ti)) { fprintf(stderr, "proc_pidinfo: too few bytes; expected %ld, got %d\n", sizeof(ti), bytes); |