]> git.ipfire.org Git - thirdparty/systemd.git/commit
sd-device: make sd_device_new_from_path() accept relative path to device node
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 7 Jan 2025 18:23:29 +0000 (03:23 +0900)
committerLennart Poettering <lennart@poettering.net>
Thu, 9 Jan 2025 08:57:19 +0000 (09:57 +0100)
commitcdd53cb74b0882ed2a249117c895b94013fa6ea9
treef1e865b10756230a6066fdda1584f8c0b610186e
parentb8582198ca1e6fe390f7169e623a9130b68a6b36
sd-device: make sd_device_new_from_path() accept relative path to device node

Even though udevadm accepts relative syspath, previously, udevadm
could not use relative path to device node:
===
$ cd /dev
$ udevadm info sda
Bad argument "sda", expected an absolute path in /dev/ or /sys/ or a unit name: Invalid argument
$ udevadm info /usr/../dev/sda
Unknown device "/usr/../dev/sda": No such device
===
With this change, both the above cases work fine.

Note, still sd_device_new_from_devname() requires absolute path starts
with /dev/, for safety.
src/libsystemd/sd-device/sd-device.c
test/units/TEST-17-UDEV.10.sh