The BLKPG* ioctl handling relies on getting the current partitions
from /sys/block/$devname/. With an md name like e.g. "vol0", the
block device to be used cannot be found and the BLKPG* ioctls are
used for all partitions. So canonicalize /dev/md/ paths as well.

Test: t6100-mdraid-partitions

Signed-off-by: Sebastian Parschauer <[email protected]>
---
 libparted/device.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libparted/device.c b/libparted/device.c
index 36fecd2..2fd3c2f 100644
--- a/libparted/device.c
+++ b/libparted/device.c
@@ -152,11 +152,8 @@ ped_device_get (const char* path)
        char*           normal_path = NULL;
 
        PED_ASSERT (path != NULL);
-       /* Don't canonicalize /dev/mapper or /dev/md/ paths, see
-          tests/symlink.c
-       */
-       if (strncmp (path, "/dev/mapper/", 12) &&
-           strncmp (path, "/dev/md/", 8))
+       /* Don't canonicalize /dev/mapper/ paths. */
+       if (strncmp (path, "/dev/mapper/", 12))
                normal_path = canonicalize_file_name (path);
        if (!normal_path)
                /* Well, maybe it is just that the file does not exist.
-- 
2.16.1


Reply via email to