summaryrefslogtreecommitdiff
path: root/psutil/_psutil_osx.c
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2021-01-15 19:07:38 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2021-01-15 19:07:38 +0100
commit4ad3380bb312b6ea06717e3adc1f60ac8daf4a05 (patch)
tree923f2b548ada7533fb6e794b8253941ec225b6f6 /psutil/_psutil_osx.c
parent3223228b0558e42508cf9f8cce84d89c79b5c52b (diff)
parente80cabe5206fd7ef14fd6a47e2571f660f95babf (diff)
downloadpsutil-new-cpu-count.tar.gz
Merge branch 'master' into new-cpu-countnew-cpu-count
Diffstat (limited to 'psutil/_psutil_osx.c')
-rw-r--r--psutil/_psutil_osx.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/psutil/_psutil_osx.c b/psutil/_psutil_osx.c
index 47b5393f..a12679ec 100644
--- a/psutil/_psutil_osx.c
+++ b/psutil/_psutil_osx.c
@@ -1027,9 +1027,18 @@ psutil_proc_connections(PyObject *self, PyObject *args) {
PROC_PIDFDSOCKETINFO, &si, sizeof(si));
// --- errors checking
- if ((nb <= 0) || (nb < sizeof(si))) {
+ if ((nb <= 0) || (nb < sizeof(si)) || (errno != 0)) {
if (errno == EBADF) {
// let's assume socket has been closed
+ psutil_debug("proc_pidfdinfo(PROC_PIDFDSOCKETINFO) -> "
+ "EBADF (ignored)");
+ continue;
+ }
+ else if (errno == EOPNOTSUPP) {
+ // may happen sometimes, see:
+ // https://github.com/giampaolo/psutil/issues/1512
+ psutil_debug("proc_pidfdinfo(PROC_PIDFDSOCKETINFO) -> "
+ "EOPNOTSUPP (ignored)");
continue;
}
else {
@@ -1063,11 +1072,6 @@ psutil_proc_connections(PyObject *self, PyObject *args) {
if (inseq == 0)
continue;
- if (errno != 0) {
- PyErr_SetFromErrno(PyExc_OSError);
- goto error;
- }
-
if ((family == AF_INET) || (family == AF_INET6)) {
if (family == AF_INET) {
inet_ntop(AF_INET,