summaryrefslogtreecommitdiff
path: root/test/name-test/test-autolaunch.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/name-test/test-autolaunch.c')
-rw-r--r--test/name-test/test-autolaunch.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/name-test/test-autolaunch.c b/test/name-test/test-autolaunch.c
index 5e519895..8b5206a6 100644
--- a/test/name-test/test-autolaunch.c
+++ b/test/name-test/test-autolaunch.c
@@ -1,3 +1,5 @@
+#include "config.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -14,21 +16,23 @@ main (int argc, char *argv[])
DBusConnection *conn = NULL;
DBusError error;
- _dbus_setenv ("DBUS_SESSION_BUS_ADDRESS", NULL);
+ dbus_setenv ("DBUS_SESSION_BUS_ADDRESS", NULL);
dbus_error_init (&error);
conn = dbus_bus_get (DBUS_BUS_SESSION, &error);
#ifdef DBUS_ENABLE_X11_AUTOLAUNCH
- if (dbus_error_is_set (&error))
+ /* If X11 autolaunch was enabled, we expect dbus-launch to have worked. */
+ if (_dbus_getenv ("DISPLAY") != NULL && dbus_error_is_set (&error))
{
fprintf (stderr, "*** Failed to autolaunch session bus: %s\n",
error.message);
dbus_error_free (&error);
return 1;
}
-#else
+#endif
+
/* We don't necessarily expect it to *work* without X (although it might -
* for instance on Mac OS it might have used launchd). Just check that the
* results are consistent. */
@@ -38,7 +42,6 @@ main (int argc, char *argv[])
fprintf (stderr, "*** Autolaunched session bus, but an error was set!\n");
return 1;
}
-#endif
if (!dbus_error_is_set (&error) && conn == NULL)
{