From bdbba583f039900ddd6d2283deb5aa40b8aea3b4 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 17 Jan 2014 17:10:46 +0000 Subject: [PATCH] inotify: make sure we set the close-on-exec flag Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73689 --- bus/dir-watch-inotify.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bus/dir-watch-inotify.c b/bus/dir-watch-inotify.c index 49ebc72..9dd7ebb 100644 --- a/bus/dir-watch-inotify.c +++ b/bus/dir-watch-inotify.c @@ -231,11 +231,17 @@ _init_inotify (BusContext *context) #else inotify_fd = inotify_init (); #endif + if (inotify_fd <= 0) { _dbus_warn ("Cannot initialize inotify\n"); goto out; } + + /* In the inotify_init1 case this is unnecessary but harmless, + * in the other cases it's necessary */ + _dbus_fd_set_close_on_exec (inotify_fd); + loop = bus_context_get_loop (context); _dbus_loop_ref (loop); -- 1.8.5.3