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).
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-07-16 16:12:42 +02:00
parent 6b9f5f01cb
commit d6d4961b01
1 changed files with 1 additions and 2 deletions

View 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)