From 53352c467ec736da985172ac4748516f8fd59ab6 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 3 Jan 2016 13:53:36 +0100 Subject: restart-radharc: only kill your own radharc, otherwise it is possible that root kills another user's radharc and replaces it with an instances own by root. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- extra/restart-radharc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'extra/restart-radharc') diff --git a/extra/restart-radharc b/extra/restart-radharc index d652deb..96af888 100755 --- a/extra/restart-radharc +++ b/extra/restart-radharc @@ -31,10 +31,13 @@ for fd in $(ls -1 /dev/fd/); do fi done +# Get the user's real UID, in a sh-portable way. +uid="$(cat /proc/self/status | grep '^Uid:' | cut -f 2)" + # Restart all instances of radharc. -for pid in pgrep -x radharc; do +for pid in pgrep -x -U $uid radharc; do # Open environ and cmdline and be sure that they we successfully opened. - # It is possible that the process has exited, or is not yours. + # It is possible that the process has exited. exec 3/dev/null if [ ! $? = 0 ]; then continue -- cgit v1.2.3-70-g09d2