diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-05-15 16:28:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-16 01:28:10 +0200 |
commit | 84a4ac3eb4465d296d00e7549242d2dc8c47b721 (patch) | |
tree | 6a13ab6ac17b9aa4f64bf65804c9c2065e873942 | |
parent | 9efb453e7163690c82226be3440cd8cb6bdffb5b (diff) | |
download | psutil-84a4ac3eb4465d296d00e7549242d2dc8c47b721.tar.gz |
[Linux] Process.rlimit() does not handle LONG LONG properly (#1760)
-rw-r--r-- | HISTORY.rst | 1 | ||||
-rw-r--r-- | psutil/_psutil_linux.c | 4 |
2 files changed, 2 insertions, 3 deletions
diff --git a/HISTORY.rst b/HISTORY.rst index c99b9c4e..3bae76b4 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -30,6 +30,7 @@ XXXX-XX-XX - 1726_: [Linux] cpu_freq() parsing should use spaces instead of tabs on ia64. (patch by Michał Górny) +- 1760_: [Linux] Process.rlimit() does not handle long long type properly. 5.7.0 ===== diff --git a/psutil/_psutil_linux.c b/psutil/_psutil_linux.c index 49e86997..c94ec035 100644 --- a/psutil/_psutil_linux.c +++ b/psutil/_psutil_linux.c @@ -158,19 +158,17 @@ psutil_linux_prlimit(PyObject *self, PyObject *args) { ret = prlimit(pid, resource, NULL, &old); if (ret == -1) return PyErr_SetFromErrno(PyExc_OSError); -#if defined(PSUTIL_HAVE_LONG_LONG) if (sizeof(old.rlim_cur) > sizeof(long)) { return Py_BuildValue("LL", (PY_LONG_LONG)old.rlim_cur, (PY_LONG_LONG)old.rlim_max); } -#endif return Py_BuildValue("ll", (long)old.rlim_cur, (long)old.rlim_max); } // set else { -#if defined(PSUTIL_HAVE_LARGEFILE_SUPPORT) +#if defined(HAVE_LONG_LONG) new.rlim_cur = PyLong_AsLongLong(py_soft); if (new.rlim_cur == (rlim_t) - 1 && PyErr_Occurred()) return NULL; |