/* 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);
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 &&
+ 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);
+
info(event->udev, "seq %llu exit with %i\n", udev_device_get_seqnum(event->dev), err);
logging_close();
if (err != 0)
int nbytes, pos;
char *buf;
struct inotify_event *ev;
- int reload_config = 0;
if ((ioctl(inotify_fd, FIONREAD, &nbytes) < 0) || (nbytes <= 0))
return 0;
char filename[UTIL_PATH_SIZE];
int fd;
- info(udev, "device %s closed, synthesising write\n", syspath);
+ info(udev, "device %s closed, synthesising 'change'\n", syspath);
util_strlcpy(filename, syspath, sizeof(filename));
util_strlcat(filename, "/uevent", sizeof(filename));
fd = open(filename, O_WRONLY);
}
free (buf);
- return reload_config;
+ return 0;
}
static void asmlinkage sig_handler(int signum)
/* rules directory inotify watch */
if (inotify_poll && (inotify_poll->revents & POLLIN))
- reload_config = handle_inotify(udev);
+ handle_inotify(udev);
handle_signals:
signal_received = 0;