summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-10-24 13:41:13 +0100
committerRalf Habacker <ralf.habacker@freenet.de>2014-10-24 18:48:18 +0200
commit3d363220ad9e16f00faa1c6cdd4913507c3e4c1a (patch)
treeba68b3417508b5cdeab68150270c94b4a5264749
parent8fd6e561dfb3f4ae888d1777c84d24fcb2483dff (diff)
downloaddbus-3d363220ad9e16f00faa1c6cdd4913507c3e4c1a.tar.gz
test-bus, test-dbus: close any inherited fds from caller
It is probably a bug for them to pass us any fds without close-on-exec; but apparently CMake has this bug, and so does at least some NetBSD GUI environment. Cope. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73689 Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83899 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
-rw-r--r--bus/test-main.c9
-rw-r--r--dbus/dbus-test-main.c9
2 files changed, 18 insertions, 0 deletions
diff --git a/bus/test-main.c b/bus/test-main.c
index 01d22870..788574fe 100644
--- a/bus/test-main.c
+++ b/bus/test-main.c
@@ -31,6 +31,10 @@
#include <dbus/dbus-message-internal.h>
#include "selinux.h"
+#ifdef DBUS_UNIX
+# include <dbus/dbus-sysdeps-unix.h>
+#endif
+
#ifdef DBUS_ENABLE_EMBEDDED_TESTS
static void
die (const char *failure)
@@ -109,6 +113,11 @@ main (int argc, char **argv)
_dbus_string_init_const (&test_data_dir, dir);
+#ifdef DBUS_UNIX
+ /* close any inherited fds so dbus-spawn's check for close-on-exec works */
+ _dbus_close_all ();
+#endif
+
if (!_dbus_threads_init_debug ())
die ("initializing debug threads");
diff --git a/dbus/dbus-test-main.c b/dbus/dbus-test-main.c
index f6ef7821..9a80f853 100644
--- a/dbus/dbus-test-main.c
+++ b/dbus/dbus-test-main.c
@@ -31,6 +31,10 @@
#include <locale.h>
#endif
+#ifdef DBUS_UNIX
+# include <dbus/dbus-sysdeps-unix.h>
+#endif
+
int
main (int argc,
char **argv)
@@ -38,6 +42,11 @@ main (int argc,
const char *test_data_dir;
const char *specific_test;
+#ifdef DBUS_UNIX
+ /* close any inherited fds so dbus-spawn's check for close-on-exec works */
+ _dbus_close_all ();
+#endif
+
#if HAVE_SETLOCALE
setlocale(LC_ALL, "");
#endif