diff options
author | Scott James Remnant <scott@ubuntu.com> | 2009-02-23 17:19:05 +0000 |
---|---|---|
committer | Scott James Remnant <scott@ubuntu.com> | 2009-02-23 17:19:05 +0000 |
commit | 521b3a9211b4e2d98bf7ae61c3844a42dde773e2 (patch) | |
tree | 1817114ed80d96359185a30529338be8dc68813e /udev | |
parent | 5ae82640c5f02c9be22e01da367875e8a3e636bf (diff) |
Clear existing inotify watch before processing.
Likewise when re-processing an event, we want to drop the existing
inotify watch first to avoid side-effects.
Diffstat (limited to 'udev')
-rw-r--r-- | udev/udevd.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/udev/udevd.c b/udev/udevd.c index e4fa2b63e1..50205f1e43 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -215,6 +215,11 @@ static void event_fork(struct udev_event *event) /* set timeout to prevent hanging processes */ alarm(UDEV_EVENT_TIMEOUT); + /* clear any existing udev watch on the node */ + if (inotify_fd != -1 && + major(udev_device_get_devnum(event->dev)) != 0) + udev_watch_clear(event->udev, event->dev); + /* apply rules, create node, symlinks */ err = udev_event_execute_rules(event, rules); @@ -229,12 +234,9 @@ static void event_fork(struct udev_event *event) /* apply/restore inotify watch */ if (err == 0 && event->inotify_watch && inotify_fd != -1 && major(udev_device_get_devnum(event->dev)) != 0 && - strcmp(udev_device_get_action(event->dev), "remove") != 0) { + strcmp(udev_device_get_action(event->dev), "remove") != 0) info(event->udev, "device will be watched for changes\n"); udev_watch_begin(event->udev, event->dev); - } else { - udev_watch_clear(event->udev, event->dev); - } info(event->udev, "seq %llu exit with %i\n", udev_device_get_seqnum(event->dev), err); logging_close(); |