From: Lennart Poettering Date: Mon, 20 Oct 2025 10:35:05 +0000 (+0200) Subject: blockdev-util: in blockdev_partscan_enabled() check if we are operating on block... X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bb45a893c2cd44b7e30b31221303b6c4e10ae1ec;p=thirdparty%2Fsystemd.git blockdev-util: in blockdev_partscan_enabled() check if we are operating on block device first The function makes no sense on any other type of fd, hence we better check this explicitly. --- diff --git a/src/shared/blockdev-util.c b/src/shared/blockdev-util.c index 7641f17aec9..4db38374beb 100644 --- a/src/shared/blockdev-util.c +++ b/src/shared/blockdev-util.c @@ -414,6 +414,12 @@ int blockdev_partscan_enabled(sd_device *dev) { assert(dev); + r = device_in_subsystem(dev, "block"); + if (r < 0) + return r; + if (r == 0) + return -ENOTBLK; + /* For v6.10 or newer. */ r = device_get_sysattr_bool(dev, "partscan"); if (r != -ENOENT)