diff options
author | Scott James Remnant <scott@ubuntu.com> | 2009-02-23 17:21:24 +0000 |
---|---|---|
committer | Scott James Remnant <scott@ubuntu.com> | 2009-02-23 17:21:24 +0000 |
commit | 03e0170db3ef69c70db7cd74e6689c7b78c91c3d (patch) | |
tree | 6fa723b6487e209993edcd5cb43d8e00dd94dfdd /udev/udev-watch.c | |
parent | 521b3a9211b4e2d98bf7ae61c3844a42dde773e2 (diff) |
Cleanup a little.
Move some of the checks into udev_watch_begin() and udev_watch_clear()
so we don't have to repeat them all the time.
Diffstat (limited to 'udev/udev-watch.c')
-rw-r--r-- | udev/udev-watch.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/udev/udev-watch.c b/udev/udev-watch.c index 24688c3b19..33b493d512 100644 --- a/udev/udev-watch.c +++ b/udev/udev-watch.c @@ -142,7 +142,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev) const char *filename; int wd; - if (inotify_fd < 0) + if (inotify_fd < 0 || major(udev_device_get_devnum(dev)) == 0) return; wd = inotify_add_watch(inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE); @@ -163,6 +163,9 @@ void udev_watch_clear(struct udev *udev, struct udev_device *dev) DIR *dir; struct dirent *ent; + if (inotify_fd < 0 || major(udev_device_get_devnum(dev)) == 0) + return; + util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); util_strlcat(filename, "/.udev/watch", sizeof(filename)); |