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.
This commit is contained in:
Lennart Poettering
2025-10-20 12:35:05 +02:00
parent a251345cf5
commit bb45a893c2

View File

@@ -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)