From 80d41cd10a382ed4af0754dadcc7464d074c000b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 5 Jul 2017 13:14:48 +0200 Subject: [PATCH] Don't use 'su' in qubes.WaitForSession if not needed --- qubes-rpc/qubes.WaitForSession | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qubes-rpc/qubes.WaitForSession b/qubes-rpc/qubes.WaitForSession index bf9c4e3..2d82d34 100755 --- a/qubes-rpc/qubes.WaitForSession +++ b/qubes-rpc/qubes.WaitForSession @@ -1,5 +1,10 @@ #!/bin/sh read USERNAME -su -c 'echo $$ >> /tmp/qubes-session-waiter; [ ! -f /tmp/qubes-session-env ] && exec sleep inf' - "$USERNAME" 2> /dev/null +cmd='echo $$ >> /tmp/qubes-session-waiter; [ ! -f /tmp/qubes-session-env ] && exec sleep inf' +if [ "$(id -un)" = "$USERNAME" ]; then + sh -c "$cmd" 2>/dev/null +else + su -c "$cmd" - "$USERNAME" 2> /dev/null +fi # the above line is _expected_ to be terminated by a signal, don't treat this as a failure exit 0