summaryrefslogtreecommitdiff
path: root/psutil/_psutil_bsd.c
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-01-27 01:20:51 +0100
committerGitHub <noreply@github.com>2020-01-27 01:20:51 +0100
commit0e8e5a983ac7e346224cfaa45856738628c1bdc5 (patch)
tree9df6219ba109aabd0ec5ecc56db4d8ce45b3a149 /psutil/_psutil_bsd.c
parentb178279e908476fa8501008d9cef20c8f362dad1 (diff)
downloadpsutil-0e8e5a983ac7e346224cfaa45856738628c1bdc5.tar.gz
OpenBSD fixes (#1673)
Diffstat (limited to 'psutil/_psutil_bsd.c')
-rw-r--r--psutil/_psutil_bsd.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/psutil/_psutil_bsd.c b/psutil/_psutil_bsd.c
index f58cc72f..30d9f9de 100644
--- a/psutil/_psutil_bsd.c
+++ b/psutil/_psutil_bsd.c
@@ -125,18 +125,8 @@ psutil_pids(PyObject *self, PyObject *args) {
if (py_retlist == NULL)
return NULL;
- // TODO: RuntimeError is inappropriate here; we could return the
- // original error instead.
- if (psutil_get_proc_list(&proclist, &num_processes) != 0) {
- if (errno != 0) {
- PyErr_SetFromErrno(PyExc_OSError);
- }
- else {
- PyErr_SetString(PyExc_RuntimeError,
- "failed to retrieve process list");
- }
+ if (psutil_get_proc_list(&proclist, &num_processes) != 0)
goto error;
- }
if (num_processes > 0) {
orig_address = proclist; // save so we can free it after we're done
@@ -475,7 +465,9 @@ psutil_proc_open_files(PyObject *self, PyObject *args) {
errno = 0;
freep = kinfo_getfile(pid, &cnt);
if (freep == NULL) {
+#if !defined(PSUTIL_OPENBSD)
psutil_raise_for_pid(pid, "kinfo_getfile()");
+#endif
goto error;
}