Only use dbus session for root when DISPLAY is set

This commit is contained in:
Ingo Ruhnke 2015-11-07 17:43:14 +01:00
parent 575170d891
commit 6e1f028b37

View file

@ -148,7 +148,21 @@ XboxdrvDaemon::run()
switch(m_opts.dbus)
{
case Options::kDBusAuto:
dbus_bus_type = DBUS_BUS_SESSION;
if (getuid() == 0)
{
if (getenv("DISPLAY"))
{
dbus_bus_type = DBUS_BUS_SESSION;
}
else
{
dbus_bus_type = DBUS_BUS_SYSTEM;
}
}
else
{
dbus_bus_type = DBUS_BUS_SESSION;
}
break;
case Options::kDBusSession: