]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-device: improve log message and tweak style
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 14 Apr 2021 09:54:17 +0000 (05:54 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 14 Apr 2021 14:19:54 +0000 (16:19 +0200)
We shouldn't say the attribute is missing right after ruling out ENOENT.

src/libsystemd/sd-device/sd-device.c

index d9ea9852e364eb19b91d53de950016ca1f6052d2..927a4f1d522e568081c3ff23933d74350bbdedc7 100644 (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 */