summaryrefslogtreecommitdiff
path: root/bus
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2018-11-20 18:06:34 +0000
committerSimon McVittie <smcv@collabora.com>2018-11-20 19:09:18 +0000
commit94806fb2c711338841ca85b82793b77d95ed0f1c (patch)
tree9bb40e2860f616b68c9df70660103a8269b67f31 /bus
parentebf487ef03e36850182e372912a41841838921b4 (diff)
downloaddbus-94806fb2c711338841ca85b82793b77d95ed0f1c.tar.gz
Don't let dbus-daemon and its subprocesses inherit unnecessary fds
This should avoid test failures under CMake in which the dbus-daemon inherits an unwanted fd from CMake's test framework, causing the close-on-exec check before executing activated services to fail. The dbus-daemon now marks all fds that it inherits, except for its stdin, stdout and stderr, to be closed on exec. For completeness, the dbus-daemons run by dbus-run-session and dbus-launch also now inherit stdin, stdout, stderr and the pipes used to communicate with their callers, but nothing else. Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'bus')
-rw-r--r--bus/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bus/main.c b/bus/main.c
index 6e8859aa..84f601b3 100644
--- a/bus/main.c
+++ b/bus/main.c
@@ -423,6 +423,10 @@ main (int argc, char **argv)
error_str, _dbus_strerror (errno));
return 1;
}
+
+ /* Set all fds >= 3 close-on-execute. We don't want activated services
+ * to inherit fds we might have inherited from our caller. */
+ _dbus_fd_set_all_close_on_exec ();
#endif
if (!_dbus_string_init (&config_file))