sd-device: improve log message and tweak style

We shouldn't say the attribute is missing right after ruling out ENOENT.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-04-14 16:19:54 +02:00
parent 2d359acda5
commit aca591ac55
+2 -3
View File
@@ -178,13 +178,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 */