]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: explicitly mention that the error will be ignored
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 2 Jun 2021 10:14:12 +0000 (19:14 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 2 Jun 2021 10:15:02 +0000 (19:15 +0900)
See #19788.

src/udev/udev-watch.c

index 7f15c87870e8b745d73d047a2cb5cb071e886c23..6032dfb4f6bf7aa0ed4684d4810ce58764bea087 100644 (file)
@@ -83,11 +83,14 @@ int udev_watch_begin(int inotify_fd, sd_device *dev) {
         log_device_debug(dev, "Adding watch on '%s'", devnode);
         wd = inotify_add_watch(inotify_fd, devnode, IN_CLOSE_WRITE);
         if (wd < 0) {
-                r = log_device_full_errno(dev, errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
-                                          errno, "Failed to add device '%s' to watch: %m", devnode);
+                bool ignore = errno == ENOENT;
+
+                r = log_device_full_errno(dev, ignore ? LOG_DEBUG : LOG_WARNING, errno,
+                                          "Failed to add device '%s' to watch%s: %m",
+                                          devnode, ignore ? ", ignoring" : "");
 
                 (void) device_set_watch_handle(dev, -1);
-                return r;
+                return ignore ? 0 : r;
         }
 
         r = device_set_watch_handle(dev, wd);