chiark / gitweb /
Cleanup a little.
[elogind.git] / udev / udevd.c
index e4fa2b63e10a58044d6cf356139bef8095aaadf0..27e64dae3acbb9a8a6d6f3388ac2842686b4e01e 100644 (file)
@@ -215,6 +215,9 @@ 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 */
+               udev_watch_clear(event->udev, event->dev);
+
                /* apply rules, create node, symlinks */
                err = udev_event_execute_rules(event, rules);
 
@@ -227,14 +230,10 @@ static void event_fork(struct udev_event *event)
                        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) {
+               if (err == 0 && event->inotify_watch &&
+                   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();