summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Baeyens <pbaeyens31+github@gmail.com>2021-08-05 15:54:39 +0200
committerGitHub <noreply@github.com>2021-08-05 15:54:39 +0200
commit5a76cfadcabf37f65f0d70e4c5b7493478b53c2c (patch)
treebaa731fef0def3592b643f2ec9f86f7942c01c2c
parent12994a739dbeae7a4e7273cb742ca9270e168763 (diff)
downloadpsutil-5a76cfadcabf37f65f0d70e4c5b7493478b53c2c.tar.gz
[Windows] Reset `mp_flag` after each drive on `psutil.disk_partitions()` (#1961)
-rw-r--r--CREDITS4
-rw-r--r--HISTORY.rst2
-rw-r--r--psutil/arch/windows/disk.c1
3 files changed, 7 insertions, 0 deletions
diff --git a/CREDITS b/CREDITS
index a46ea44a..c614c422 100644
--- a/CREDITS
+++ b/CREDITS
@@ -754,3 +754,7 @@ C: Russia
E: gorbunov.dmitry.1999@gmail.com
W: https://gorbunov-dmitry.github.io
D: fix typos in documentation
+
+N: Pablo Baeyens
+W: https://github.com/mx-psi
+I: 1598
diff --git a/HISTORY.rst b/HISTORY.rst
index 82e5e782..4058d660 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -25,6 +25,8 @@ XXXX-XX-XX
- 1921_: [Windows] psutil.swap_memory() shows committed memory instead of swap
- 1953_: [Windows] disk_partitions() crashes due to insufficient buffer len.
(patch by MaWe2019)
+- 1598_: [Windows] psutil.disk_partitions() only returns mountpoints on drives
+ where it first finds one
5.8.0
=====
diff --git a/psutil/arch/windows/disk.c b/psutil/arch/windows/disk.c
index 0d8be2fa..7c35e812 100644
--- a/psutil/arch/windows/disk.c
+++ b/psutil/arch/windows/disk.c
@@ -290,6 +290,7 @@ psutil_disk_partitions(PyObject *self, PyObject *args) {
mp_h = FindFirstVolumeMountPoint(
drive_letter, mp_buf, MAX_PATH);
if (mp_h != INVALID_HANDLE_VALUE) {
+ mp_flag = TRUE;
while (mp_flag) {
// Append full mount path with drive letter
strcpy_s(mp_path, _countof(mp_path), drive_letter);