X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=udev%2Fudev-watch.c;h=d67083b51b3a67e3d14f9d2a7b6b4ef5113646a2;hp=5a49c963da82a0651aa50c7612580419abc063c6;hb=26347a4c5538008318188118872490128f43fcd3;hpb=1e03b754aef576a5cb75f01b1805cdc1f9cc292f diff --git a/udev/udev-watch.c b/udev/udev-watch.c index 5a49c963d..d67083b51 100644 --- a/udev/udev-watch.c +++ b/udev/udev-watch.c @@ -38,10 +38,8 @@ static int inotify_fd = -1; */ 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; } @@ -121,6 +119,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev) 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);