When a new device is processed, there should be no watch handle for
the device, hence udev_watch_clear() provides -1. Let's not try to call
inotify_rm_watch() in that case.
This should not change any behavior. Just for suppressing spurious
debugging log:
=====
(udev-worker)[
3626140]: zram1: Removing watch handle -1.
=====
(cherry picked from commit
b3b442062045eac61a9dd3ed73b650dfb5be0b46)
if (ret_wd)
*ret_wd = wd;
- r = 0;
+ r = 1;
finalize:
/* 5. remove symlink ID -> wd.
/* First, clear symlinks. */
r = udev_watch_clear(dev, dirfd, &wd);
- if (r < 0)
+ if (r <= 0)
return r;
/* Then, remove inotify watch. */