mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-03-08 20:58:20 +03:00
udevadm: do not try to find device unit when a path like string is provided
Otherwise, we provide misleading error message. Before: --- $ udevadm info /sys/class/foo Bad argument "/sys/class/foo", expected an absolute path in /dev/ or /sys/ or a unit name: Invalid argument --- After: --- $ udevadm info /sys/class/foo Unknown device "/sys/class/foo": No such device ---
This commit is contained in:
parent
957dfcc96d
commit
4273a041f1
@ -72,6 +72,10 @@ int find_device(const char *id, const char *prefix, sd_device **ret) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* if a path is provided, then it cannot be a unit name. Let's return earlier. */
|
||||
if (is_path(id))
|
||||
return -ENODEV;
|
||||
|
||||
/* Check if the argument looks like a device unit name. */
|
||||
return find_device_from_unit(id, ret);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user