From: Yu Watanabe Date: Wed, 2 Jun 2021 10:14:12 +0000 (+0900) Subject: udev: explicitly mention that the error will be ignored X-Git-Tag: v249-rc1~111^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d46969072aee230bf231ea8aa2eae9f7d61a1e7a;p=thirdparty%2Fsystemd.git udev: explicitly mention that the error will be ignored See #19788. --- diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c index 7f15c87870e..6032dfb4f6b 100644 --- a/src/udev/udev-watch.c +++ b/src/udev/udev-watch.c @@ -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);