summaryrefslogtreecommitdiffstats
path: root/src/udev/udev-watch.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-10-27 01:19:51 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-11-06 03:15:39 +0100
commit7fe3324c5e893a0fa3361ae97882aac4849c646f (patch)
treef5a2723c94432bd5a518c9e31aaf0f4bf8f04782 /src/udev/udev-watch.c
parentudev: drop redundant log message and fix returned error code (diff)
downloadsystemd-7fe3324c5e893a0fa3361ae97882aac4849c646f.tar.xz
systemd-7fe3324c5e893a0fa3361ae97882aac4849c646f.zip
udev-watch: make udev_watch_lookup() return 1 when device found
Diffstat (limited to 'src/udev/udev-watch.c')
-rw-r--r--src/udev/udev-watch.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c
index 1d3d9f1c08..f63a5839d6 100644
--- a/src/udev/udev-watch.c
+++ b/src/udev/udev-watch.c
@@ -147,22 +147,23 @@ int udev_watch_lookup(int wd, sd_device **ret) {
assert(ret);
if (inotify_fd < 0)
- return log_error_errno(EINVAL, "Invalid inotify descriptor.");
+ return log_debug_errno(EINVAL, "Invalid inotify descriptor.");
if (wd < 0)
- return log_error_errno(EINVAL, "Invalid watch handle.");
+ return log_debug_errno(EINVAL, "Invalid watch handle.");
xsprintf(filename, "/run/udev/watch/%d", wd);
r = readlink_malloc(filename, &device);
- if (r < 0) {
- if (r != -ENOENT)
- return log_error_errno(errno, "Failed to read link '%s': %m", filename);
+ if (r == -ENOENT)
return 0;
- }
+ if (r < 0)
+ return log_debug_errno(r, "Failed to read link '%s': %m", filename);
r = sd_device_new_from_device_id(ret, device);
+ if (r == -ENODEV)
+ return 0;
if (r < 0)
- return log_error_errno(r, "Failed to create sd_device object for '%s': %m", device);
+ return log_debug_errno(r, "Failed to create sd_device object for '%s': %m", device);
- return 0;
+ return 1;
}