diff mbox

[v2] sandbox: Use dbus-run-session instead of dbus-launch when available

Message ID 20160927115426.23097-1-bigon@debian.org (mailing list archive)
State Not Applicable
Headers show

Commit Message

Laurent Bigonville Sept. 27, 2016, 11:54 a.m. UTC
From: Laurent Bigonville <bigon@bigon.be>

According to dbus upstream: "dbus-launch is fairly horrible code,
complicated by the historical need for it to support X11 autolaunching,
so the D-Bus maintainers would like to move it out of the critical path
and minimize its use."

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=836289

Signed-off-by: Laurent Bigonville <bigon@bigon.be>
---
 policycoreutils/sandbox/sandbox | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/policycoreutils/sandbox/sandbox b/policycoreutils/sandbox/sandbox
index b6bc805..bfb2de3 100644
--- a/policycoreutils/sandbox/sandbox
+++ b/policycoreutils/sandbox/sandbox
@@ -285,7 +285,11 @@  class Sandbox:
 # /usr/bin/test -r ~/.xmodmap && /usr/bin/xmodmap ~/.xmodmap
 %s &
 WM_PID=$!
-dbus-launch --exit-with-session %s
+if which dbus-run-session >/dev/null 2>&1; then
+    dbus-run-session -- %s
+else
+    dbus-launch --exit-with-session %s
+fi
 kill -TERM $WM_PID  2> /dev/null
 """ % (command, wm, command))
         fd.close()