]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: fix the errno check if a couple of places
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 24 Oct 2022 17:12:55 +0000 (19:12 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 24 Oct 2022 19:08:17 +0000 (04:08 +0900)
Follow-up to 691a596da15.

src/udev/udev-watch.c

index 2a9ff2909b08f9cfeb6393ee378dda963da16632..abd1d8fea506964b6b1c0aeceb60c6e258eb1ad4 100644 (file)
@@ -155,7 +155,7 @@ static int udev_watch_clear(sd_device *dev, int dirfd, int *ret_wd) {
          * In the above, we already confirmed that the symlink is owned by us. Hence, no other workers remove
          * the symlink and cannot create a new symlink with the same filename but to a different ID. Hence,
          * the removal below is safe even the steps in this function are not atomic. */
-        if (unlinkat(dirfd, wd_str, 0) < 0 && errno != -ENOENT)
+        if (unlinkat(dirfd, wd_str, 0) < 0 && errno != ENOENT)
                 log_device_debug_errno(dev, errno, "Failed to remove '/run/udev/watch/%s', ignoring: %m", wd_str);
 
         if (ret_wd)
@@ -165,7 +165,7 @@ static int udev_watch_clear(sd_device *dev, int dirfd, int *ret_wd) {
 finalize:
         /* 5. remove symlink ID -> wd.
          * The file is always owned by the device. Hence, it is safe to remove it unconditionally. */
-        if (unlinkat(dirfd, id, 0) < 0 && errno != -ENOENT)
+        if (unlinkat(dirfd, id, 0) < 0 && errno != ENOENT)
                 log_device_debug_errno(dev, errno, "Failed to remove '/run/udev/watch/%s': %m", id);
 
         return r;