X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udev%2Fudev-watch.c;h=d333476346375a4e377f9031b1000f27ce5c77fc;hb=b44b7f884136e1ef4452818ed514a5d7e51567f1;hp=e2c096af0f4d0f3459f57805815894c9c7d4c564;hpb=45bcd16ca5e2c7917579c63f701683e47b3a4008;p=elogind.git diff --git a/udev/udev-watch.c b/udev/udev-watch.c index e2c096af0..d33347634 100644 --- a/udev/udev-watch.c +++ b/udev/udev-watch.c @@ -41,16 +41,9 @@ int inotify_fd = -1; void udev_watch_init(struct udev *udev) { inotify_fd = inotify_init(); - if (inotify_fd >= 0) { - int flags; - - flags = fcntl(inotify_fd, F_GETFD); - if (flags < 0) - flags = FD_CLOEXEC; - else - flags |= FD_CLOEXEC; - fcntl(inotify_fd, F_SETFD, flags); - } else if (errno == ENOSYS) + if (inotify_fd >= 0) + util_set_fd_cloexec(inotify_fd); + else if (errno == ENOSYS) info(udev, "unable to use inotify, udevd will not monitor rule files changes\n"); else err(udev, "inotify_init failed: %m\n");