From d6d4961b01a986984f018bae141eabbce83f0e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 16 Jul 2020 16:12:42 +0200 Subject: [PATCH] udev: don't complain when udev_watch_end() is called without udev_watch_init() E.g. udevadm test prints "Invalid inotify descriptor." which is meaningless without any context. I think it should be OK to call udev_watch_end() from a cleanup path without any warning (even at debug level). --- src/udev/udev-watch.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c index 68b51d04a3..96a25ddf7c 100644 --- a/src/udev/udev-watch.c +++ b/src/udev/udev-watch.c @@ -125,8 +125,7 @@ int udev_watch_end(sd_device *dev) { int wd, r; if (inotify_fd < 0) - return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), - "Invalid inotify descriptor."); + return 0; /* Nothing to do. */ r = device_get_watch_handle(dev, &wd); if (r == -ENOENT)