udev: don't complain when udev_watch_end() is called without udev_watch_init()
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 16 Jul 2020 14:12:42 +0000 (16:12 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 27 Jul 2020 08:26:34 +0000 (10:26 +0200)
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).

(cherry picked from commit d6d4961b01a986984f018bae141eabbce83f0e20)

src/udev/udev-watch.c

index 68b51d04a3598ece06ab7a6c5063426b306450ee..96a25ddf7cfcd0047829ea69b37ded37786cebde 100644 (file)
@@ -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)