sd-device: generate e better error code when trying to allocate sd_device for non-dir
authorLennart Poettering <lennart@poettering.net>
Tue, 12 Apr 2022 09:42:30 +0000 (11:42 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 13 Apr 2022 12:41:03 +0000 (14:41 +0200)
commit5cf0ee31eca931c706e1f316099b449a12cadb6d
tree58b10dd58d186eaf48065c43324de31d5ab24f5c
parenta7910612a5be324d8b6994a2f7e1a2edb63ad03c
sd-device: generate e better error code when trying to allocate sd_device for non-dir

Currently, for sysfs paths outside of /sys/devices/ we do better
checking if something is a suitable path: we check if it's actually a
directory, and if not return ENODEV.

Let's make the codepath for nodes *inside* of /sys/device/ similar:
let's also return ENODEV if the path supplied is not a directory.

Previously, we'd return ENOTDIR in that case, which is quite confusing I
think.
src/libsystemd/sd-device/sd-device.c