diff options
author | 2023-11-15 13:46:09 +0100 | |
---|---|---|
committer | 2023-11-15 13:46:09 +0100 | |
commit | 6e07f600ba9204d9b01c401b21531ebdba15322e (patch) | |
tree | 03f2fc0c5a3dca28bd9a72a6409802f46bdc8d1c | |
parent | sd-journal: don't treat invalid match as a programming error (diff) | |
download | systemd-6e07f600ba9204d9b01c401b21531ebdba15322e.tar.xz systemd-6e07f600ba9204d9b01c401b21531ebdba15322e.zip |
mount: don't call sd_device_get_property_value() with a NULL pointer
Otherwise bad thing would've happened is this was a hard assert:
+ systemd-mount --umount /dev/loop0
Assertion 'device' failed at src/libsystemd/sd-device/sd-device.c:2202, function sd_device_get_property_value(). Ignoring.
-rw-r--r-- | src/mount/mount-tool.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/mount/mount-tool.c b/src/mount/mount-tool.c index 5876e2ddb47..f626f07af63 100644 --- a/src/mount/mount-tool.c +++ b/src/mount/mount-tool.c @@ -975,7 +975,6 @@ static int stop_mounts( } static int umount_by_device(sd_bus *bus, sd_device *dev) { - _cleanup_(sd_device_unrefp) sd_device *d = NULL; _cleanup_strv_free_ char **list = NULL; const char *v; int r, ret = 0; @@ -983,7 +982,7 @@ static int umount_by_device(sd_bus *bus, sd_device *dev) { assert(bus); assert(dev); - if (sd_device_get_property_value(d, "SYSTEMD_MOUNT_WHERE", &v) >= 0) + if (sd_device_get_property_value(dev, "SYSTEMD_MOUNT_WHERE", &v) >= 0) ret = stop_mounts(bus, v); r = sd_device_get_devname(dev, &v); |