]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
inotify: make sure we set the close-on-exec flag
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 23 Sep 2014 18:25:31 +0000 (19:25 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 23 Sep 2014 18:25:55 +0000 (19:25 +0100)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73689
Reviewed-by: Ralf Habacker
[add <dbus/dbus-sysdeps-unix.h> which is now required for
_dbus_fd_set_close_on_exec -smcv]

bus/dir-watch-inotify.c

index 49ebc721b0b904a8183a505b368de7049bca90cf..ce19fdc8b12509167e32096b489d1076ddd5b533 100644 (file)
@@ -38,6 +38,7 @@
 
 #include <dbus/dbus-internals.h>
 #include <dbus/dbus-list.h>
+#include <dbus/dbus-sysdeps-unix.h>
 #include <dbus/dbus-watch.h>
 #include "dir-watch.h"
 
@@ -236,6 +237,11 @@ _init_inotify (BusContext *context)
           _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);