summaryrefslogtreecommitdiff
path: root/udev/udevd.c
diff options
context:
space:
mode:
authorScott James Remnant <scott@ubuntu.com>2009-02-23 17:17:20 +0000
committerScott James Remnant <scott@ubuntu.com>2009-02-23 17:17:20 +0000
commit5ae82640c5f02c9be22e01da367875e8a3e636bf (patch)
treee0bf2e2b0996a8691b02c91f4935ad07983992b3 /udev/udevd.c
parente8c84c98b9452dd1f4fe738f7e12149e0198dff6 (diff)
Don't add inotify watch until RUN rules processed.
The programs we RUN can open device nodes, and thus we can end up chasing our own tail.
Diffstat (limited to 'udev/udevd.c')
-rw-r--r--udev/udevd.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/udev/udevd.c b/udev/udevd.c
index 094175ac4a..e4fa2b63e1 100644
--- a/udev/udevd.c
+++ b/udev/udevd.c
@@ -226,6 +226,16 @@ static void event_fork(struct udev_event *event)
if (err == 0 && !event->ignore_device && udev_get_run(event->udev))
udev_event_execute_run(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) {
+ 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();
if (err != 0)