sysupgrade: don't kill our own parent

Add the parent of the sysupgrade script to the list of pids not getting
killed

Signed-off-by: Mat Trudel <mat@geeky.net>
Signed-off-by: John Crispin <john@phrozen.org>
owl
Mat Trudel 2017-11-07 20:55:54 +01:00 committed by John Crispin
parent 31691f9649
commit 2dca7177e7
1 changed files with 3 additions and 2 deletions

View File

@ -84,6 +84,7 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
local loop="${2:-0}" local loop="${2:-0}"
local run=true local run=true
local stat local stat
local proc_ppid=$(cut -d' ' -f4 /proc/$$/stat)
echo -n "Sending $sig to remaining processes ... " echo -n "Sending $sig to remaining processes ... "
@ -96,8 +97,8 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
read pid name state ppid rest < $stat read pid name state ppid rest < $stat
name="${name#(}"; name="${name%)}" name="${name#(}"; name="${name%)}"
# Skip PID1, ourself and our children # Skip PID1, our parent, ourself and our children
[ $pid -ne 1 -a $pid -ne $$ -a $ppid -ne $$ ] || continue [ $pid -ne 1 -a $pid -ne $proc_ppid -a $pid -ne $$ -a $ppid -ne $$ ] || continue
local cmdline local cmdline
read cmdline < /proc/$pid/cmdline read cmdline < /proc/$pid/cmdline