summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2011-02-24 18:17:07 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2011-02-24 18:43:34 +0000
commit407c11167273ca388de6f0e770272067bff89ffb (patch)
tree6ea531989f155ecf1a08e5e871cee640b44de657
parent7848abe6c2b90b66fbf1fd7e582324b28766b8de (diff)
Don't attempt Unix X11 autolaunching if DISPLAY isn't set
The known use cases for autolaunching (ssh -Y firefox, run konqueror in legacy DE) all need $DISPLAY too. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=19997
-rw-r--r--dbus/dbus-sysdeps-unix.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
index 9076600a..ff902ff1 100644
--- a/dbus/dbus-sysdeps-unix.c
+++ b/dbus/dbus-sysdeps-unix.c
@@ -3265,6 +3265,18 @@ _dbus_get_autolaunch_address (const char *scope,
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
retval = FALSE;
+ /* fd.o #19997: if $DISPLAY isn't set to something useful, then
+ * dbus-launch-x11 is just going to fail. Rather than trying to
+ * run it, we might as well bail out early with a nice error. */
+ display = _dbus_getenv ("DISPLAY");
+
+ if (display == NULL || display[0] == '\0')
+ {
+ dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED,
+ "Unable to autolaunch a dbus-daemon without DISPLAY set");
+ return FALSE;
+ }
+
if (!_dbus_string_init (&uuid))
{
_DBUS_SET_OOM (error);