1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-01 05:47:04 +03:00

sd-device: improve log message and tweak style

We shouldn't say the attribute is missing right after ruling out ENOENT.

(cherry picked from commit aca591ac55e5ee364905aec975388c5e30d0476c)
(cherry picked from commit e31914aa17df889ae10f0964a8bbc8c00e0f045b)
(cherry picked from commit 645c85022ac6c035ccdd0590db687c5be1147e85)
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-04-14 05:54:17 -04:00
parent dde6f2081f
commit 16501c1c70

View File

@ -180,13 +180,12 @@ int device_set_syspath(sd_device *device, const char *_syspath, bool verify) {
/* all 'devices' require an 'uevent' file */
path = strjoina(syspath, "/uevent");
r = access(path, F_OK);
if (r < 0) {
if (access(path, F_OK) < 0) {
if (errno == ENOENT)
/* this is not a valid device */
return -ENODEV;
return log_debug_errno(errno, "sd-device: %s does not have an uevent file: %m", syspath);
return log_debug_errno(errno, "sd-device: cannot access uevent file for %s: %m", syspath);
}
} else {
/* everything else just needs to be a directory */