mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 16:37:19 +09:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user