summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2019-04-02 16:29:00 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2019-04-02 16:29:00 +0200
commit0d43eb01aa4aee544cda97fd190c1ddd0f2e946e (patch)
treebb57af44aeaae3a94f8a77503a09fb8a11738bc1
parent0ef3a9672fa87bc2ef55133a5b54c309aec521b6 (diff)
parente91c041d84aa34790ebd6396dcbbc2e3391b0a73 (diff)
downloadpsutil-0d43eb01aa4aee544cda97fd190c1ddd0f2e946e.tar.gz
Merge branch 'master' of github.com:giampaolo/psutil
-rw-r--r--psutil/_pslinux.py8
-rw-r--r--psutil/_psutil_sunos.c4
-rw-r--r--psutil/_psutil_windows.c4
3 files changed, 9 insertions, 7 deletions
diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py
index 3502f1b1..fac9e781 100644
--- a/psutil/_pslinux.py
+++ b/psutil/_pslinux.py
@@ -1169,13 +1169,13 @@ def disk_partitions(all=False):
fstypes.add("zfs")
# See: https://github.com/giampaolo/psutil/issues/1307
- if procfs_path == "/proc":
- mtab_path = os.path.realpath("/etc/mtab")
+ if procfs_path == "/proc" and os.path.isfile('/etc/mtab'):
+ mounts_path = os.path.realpath("/etc/mtab")
else:
- mtab_path = os.path.realpath("%s/self/mounts" % procfs_path)
+ mounts_path = os.path.realpath("%s/self/mounts" % procfs_path)
retlist = []
- partitions = cext.disk_partitions(mtab_path)
+ partitions = cext.disk_partitions(mounts_path)
for partition in partitions:
device, mountpoint, fstype, opts = partition
if device == 'none':
diff --git a/psutil/_psutil_sunos.c b/psutil/_psutil_sunos.c
index 99423f7a..49100ec6 100644
--- a/psutil/_psutil_sunos.c
+++ b/psutil/_psutil_sunos.c
@@ -218,8 +218,10 @@ psutil_proc_name_and_args(PyObject *self, PyObject *args) {
/* If we can't read process memory or can't decode the result
* then return args from /proc. */
- if (!py_args)
+ if (!py_args) {
+ PyErr_Clear();
py_args = PyUnicode_DecodeFSDefault(info.pr_psargs);
+ }
/* Both methods has been failed. */
if (!py_args)
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c
index 9fd8d9c7..4dfae2d5 100644
--- a/psutil/_psutil_windows.c
+++ b/psutil/_psutil_windows.c
@@ -377,7 +377,7 @@ psutil_proc_cpu_times(PyObject *self, PyObject *args) {
/*
* User and kernel times are represented as a FILETIME structure
- * wich contains a 64-bit value representing the number of
+ * which contains a 64-bit value representing the number of
* 100-nanosecond intervals since January 1, 1601 (UTC):
* http://msdn.microsoft.com/en-us/library/ms724284(VS.85).aspx
* To convert it into a float representing the seconds that the
@@ -1118,7 +1118,7 @@ psutil_proc_threads(PyObject *self, PyObject *args) {
/*
* User and kernel times are represented as a FILETIME structure
- * wich contains a 64-bit value representing the number of
+ * which contains a 64-bit value representing the number of
* 100-nanosecond intervals since January 1, 1601 (UTC):
* http://msdn.microsoft.com/en-us/library/ms724284(VS.85).aspx
* To convert it into a float representing the seconds that the