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>
#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)
_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");
#include <locale.h>
#endif
+#ifdef DBUS_UNIX
+# include <dbus/dbus-sysdeps-unix.h>
+#endif
+
int
main (int argc,
char **argv)
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