summaryrefslogtreecommitdiffstats
path: root/bus/dir-watch-inotify.c
diff options
context:
space:
mode:
Diffstat (limited to 'bus/dir-watch-inotify.c')
-rw-r--r--bus/dir-watch-inotify.c4
1 files changed, 4 insertions, 0 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;