diff options
author | Matthias Clasen <mclasen@redhat.com> | 2009-07-10 20:10:12 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2009-07-10 20:11:22 -0400 |
commit | f4e15893e5be6da6c7642bb7ef9b14d5531afe41 (patch) | |
tree | 6eae4c99652cde63c455356a64705890713ab381 | |
parent | 98bbe8c7941f2c643dc55b4e7329c0da57d2c7bc (diff) |
Bug 22516 - Ensure inotify fd is set close on exec
This prevents it leaking into spawned child processes.
Signed-off-by: Colin Walters <walters@verbum.org>
-rw-r--r-- | bus/dir-watch-inotify.c | 4 | ||||
-rw-r--r-- | configure.in | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/bus/dir-watch-inotify.c b/bus/dir-watch-inotify.c index 3d8a6663..f03e1bd7 100644 --- a/bus/dir-watch-inotify.c +++ b/bus/dir-watch-inotify.c @@ -98,7 +98,11 @@ bus_watch_directory (const char *dir, BusContext *context) _dbus_assert (dir != NULL); if (inotify_fd == -1) { +#ifdef HAVE_INOTIFY_INIT1 + inotify_fd = inotify_init1 (IN_CLOEXEC); +#else inotify_fd = inotify_init (); +#endif if (inotify_fd <= 0) { _dbus_warn ("Cannot initialize inotify\n"); goto out; diff --git a/configure.in b/configure.in index 3d159638..3af9cf7c 100644 --- a/configure.in +++ b/configure.in @@ -754,7 +754,7 @@ fi dnl check if inotify backend is enabled if test x$have_inotify = xyes; then AC_DEFINE(DBUS_BUS_ENABLE_INOTIFY,1,[Use inotify]) - + AC_CHECK_FUNCS(inotify_init1) fi AM_CONDITIONAL(DBUS_BUS_ENABLE_INOTIFY, test x$have_inotify = xyes) |