From: Yu Watanabe Date: Sun, 21 Feb 2021 02:16:18 +0000 (+0900) Subject: dissect-image: also check devtype in device_is_partition() X-Git-Tag: v249-rc1~483^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=11368b694e0918721af3f0917f05283fe0285b8e;p=thirdparty%2Fsystemd.git dissect-image: also check devtype in device_is_partition() This should be mostly redundant. Just for safety. --- 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);