Commit 86c6dbd2 authored by Simon McVittie's avatar Simon McVittie

Don't assume that X11 autolaunch will work if DISPLAY is unset

In practice, it won't; other forms of autolaunch (like Mac OS launchd)
might, but we can't really assert either way.

Bug: default avatarChengwei Yang <>
[amended to reinstate use of dbus/dbus-sysdeps.h which was removed
by 412538b3 -smcv]
Signed-off-by: default avatarSimon McVittie <>
parent ee0f28f6
......@@ -8,6 +8,7 @@
#include <dbus/dbus.h>
#include "dbus/dbus-sysdeps.h"
main (int argc, char *argv[])
......@@ -22,14 +23,16 @@ main (int argc, char *argv[])
conn = dbus_bus_get (DBUS_BUS_SESSION, &error);
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",
dbus_error_free (&error);
return 1;
/* 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. */
......@@ -39,7 +42,6 @@ main (int argc, char *argv[])
fprintf (stderr, "*** Autolaunched session bus, but an error was set!\n");
return 1;
if (!dbus_error_is_set (&error) && conn == NULL)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment