From 11368b694e0918721af3f0917f05283fe0285b8e Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 21 Feb 2021 11:16:18 +0900 Subject: [PATCH] dissect-image: also check devtype in device_is_partition() This should be mostly redundant. Just for safety. --- src/shared/dissect-image.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c index fb8df16ebc3..4a76902b07e 100644 --- a/src/shared/dissect-image.c +++ b/src/shared/dissect-image.c @@ -147,15 +147,18 @@ static int device_is_partition(sd_device *d, blkid_partition pp) { blkid_loff_t bsize, bstart; uint64_t size, start; int partno, bpartno, r; - const char *ss, *v; + const char *v; assert(d); assert(pp); - r = sd_device_get_subsystem(d, &ss); + r = sd_device_get_subsystem(d, &v); if (r < 0) return r; - if (!streq(ss, "block")) + if (!streq(v, "block")) + return false; + + if (sd_device_get_devtype(d, &v) < 0 || !streq(v, "partition")) return false; r = sd_device_get_sysattr_value(d, "partition", &v);