diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-06-02 12:14:12 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-06-02 12:15:02 +0200 |
commit | d46969072aee230bf231ea8aa2eae9f7d61a1e7a (patch) | |
tree | 84773de1351c1ad610a20f79aa6e67ddcf907cd8 /src/udev/udev-watch.c | |
parent | udev: ignore the case that the device is already removed (diff) | |
download | systemd-d46969072aee230bf231ea8aa2eae9f7d61a1e7a.tar.xz systemd-d46969072aee230bf231ea8aa2eae9f7d61a1e7a.zip |
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.c | 9 |
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); |