diff options
| author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-10-05 16:26:06 +0200 |
|---|---|---|
| committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-10-05 16:26:06 +0200 |
| commit | 6e1a4c6b1c8e4269c8ef3b67c8eeb1dee1e2ee55 (patch) | |
| tree | 739c9143613ecc69d125736dc0b1710ba7ffe157 /psutil/arch/osx/process_info.c | |
| parent | 093c19d8ba7199322a4bd4cb14e331f088faafd5 (diff) | |
| download | psutil-6e1a4c6b1c8e4269c8ef3b67c8eeb1dee1e2ee55.tar.gz | |
have proc_pidinfo() guess the right error/exception
Diffstat (limited to 'psutil/arch/osx/process_info.c')
| -rw-r--r-- | psutil/arch/osx/process_info.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/psutil/arch/osx/process_info.c b/psutil/arch/osx/process_info.c index f85fcc08..402cbb8e 100644 --- a/psutil/arch/osx/process_info.c +++ b/psutil/arch/osx/process_info.c @@ -353,26 +353,15 @@ psutil_get_kinfo_proc(pid_t pid, struct kinfo_proc *kp) { /* - * A thin wrapper around proc_pidinfo() + * A wrapper around proc_pidinfo(). */ int psutil_proc_pidinfo(long pid, int flavor, uint64_t arg, void *pti, int size) { + errno = 0; int ret = proc_pidinfo((int)pid, flavor, arg, pti, size); if (ret == 0) { - if (! psutil_pid_exists(pid)) { - NoSuchProcess(); - return 0; - } - else { - AccessDenied(); - return 0; - } - } - else if (ret != size) { - AccessDenied(); + psutil_raise_for_pid(pid, "proc_pidinfo() syscall failed"); return 0; } - else { - return 1; - } + return 1; } |
