]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
test-bus, test-dbus: close any inherited fds from caller
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 24 Oct 2014 12:41:13 +0000 (13:41 +0100)
committerRalf Habacker <ralf.habacker@freenet.de>
Fri, 24 Oct 2014 16:48:18 +0000 (18:48 +0200)
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>
bus/test-main.c
dbus/dbus-test-main.c

index 01d228704c1d52a5da06c18fe42b082a3383b5ef..788574fe16e84ba9c39827cc59f65d42dd350256 100644 (file)
 #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");
 
index f6ef7821d55999e6469b3c0fd74761b419091950..9a80f853b4a7830bacf76b415ea3cf77f9f061f0 100644 (file)
 #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