diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-09-13 14:59:17 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-09-13 14:59:17 +0100 |
commit | 86c6dbd20b578e28f383ade7c9af1572e4169347 (patch) | |
tree | 46cd1e4b93290cc089fde53316b10ed7e5186dfd /test | |
parent | ee0f28f6a575337fe6d0571f5935f82a601c37c9 (diff) | |
download | dbus-86c6dbd20b578e28f383ade7c9af1572e4169347.tar.gz |
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: https://bugs.freedesktop.org/show_bug.cgi?id=40352
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
[amended to reinstate use of dbus/dbus-sysdeps.h which was removed
by 412538b3b9 -smcv]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'test')
-rw-r--r-- | test/name-test/test-autolaunch.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/name-test/test-autolaunch.c b/test/name-test/test-autolaunch.c index 732e6dc7..8b5206a6 100644 --- a/test/name-test/test-autolaunch.c +++ b/test/name-test/test-autolaunch.c @@ -8,6 +8,7 @@ #endif #include <dbus/dbus.h> +#include "dbus/dbus-sysdeps.h" int main (int argc, char *argv[]) @@ -22,14 +23,16 @@ main (int argc, char *argv[]) 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. */ @@ -39,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) { |