udev: fix error handling of sd_device_get_parent()

sd_device_get_parent() returns -EINVAL or -ENOENT on error, not -ENODEV.

Fixes #16207.
This commit is contained in:
Yu Watanabe 2020-06-18 13:48:44 +09:00
parent 2a71d57f4e
commit bc568a7a35

View file

@ -370,7 +370,7 @@ static ssize_t udev_event_subst_format(
}
case FORMAT_SUBST_PARENT:
r = sd_device_get_parent(dev, &parent);
if (r == -ENODEV)
if (r == -ENOENT)
goto null_terminate;
if (r < 0)
return r;