Skip to content

Commit

Permalink
netbsd / cwd: raise NSP on ENOENT
Browse files Browse the repository at this point in the history
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
  • Loading branch information
giampaolo committed Dec 19, 2023
1 parent 725e223 commit 69e54c8
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions psutil/arch/netbsd/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,10 @@ psutil_proc_cwd(PyObject *self, PyObject *args) {
ssize_t len = readlink(buf, path, sizeof(path) - 1);
free(buf);
if (len == -1) {
if (errno == ENOENT) {
psutil_debug("sysctl(KERN_PROC_CWD) -> ENOENT converted to ''");
return Py_BuildValue("s", "");
}
else {
if (errno == ENOENT)
NoSuchProcess("sysctl -> ENOENT");
else
PyErr_SetFromErrno(PyExc_OSError);
}
return NULL;
}
path[len] = '\0';
Expand Down

0 comments on commit 69e54c8

Please sign in to comment.