*/
int udev_watch_init(struct udev *udev)
{
- inotify_fd = inotify_init();
- if (inotify_fd >= 0)
- util_set_fd_cloexec(inotify_fd);
- else
+ inotify_fd = inotify_init1(IN_CLOEXEC);
+ if (inotify_fd < 0)
err(udev, "inotify_init failed: %m\n");
return inotify_fd;
}
if (wd < 0) {
err(udev, "inotify_add_watch(%d, %s, %o) failed: %m\n",
inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
+ return;
}
snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd);