summaryrefslogtreecommitdiff
path: root/src/udev/udev-watch.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-06-02 19:14:12 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-06-02 19:15:02 +0900
commitd46969072aee230bf231ea8aa2eae9f7d61a1e7a (patch)
tree84773de1351c1ad610a20f79aa6e67ddcf907cd8 /src/udev/udev-watch.c
parent6be1feb1d7e30c0e7591121b74d4c3c7079de6b3 (diff)
downloadsystemd-d46969072aee230bf231ea8aa2eae9f7d61a1e7a.tar.gz
udev: explicitly mention that the error will be ignored
See #19788.
Diffstat (limited to 'src/udev/udev-watch.c')
-rw-r--r--src/udev/udev-watch.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c
index 7f15c87870..6032dfb4f6 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);