summaryrefslogtreecommitdiff
path: root/package/base-files/files/lib
diff options
context:
space:
mode:
authorMat Trudel <mat@geeky.net>2017-11-07 20:55:54 +0100
committerJohn Crispin <john@phrozen.org>2017-11-15 21:11:23 +0100
commit2dca7177e75d2b910ace883e08cbadcaa050666f (patch)
tree3aa91a3803bca1450b2946845c5b8655563cd55b /package/base-files/files/lib
parent31691f9649b096eac387137de2dbf07f767508f7 (diff)
downloadmtk-20170518-2dca7177e75d2b910ace883e08cbadcaa050666f.zip
mtk-20170518-2dca7177e75d2b910ace883e08cbadcaa050666f.tar.gz
mtk-20170518-2dca7177e75d2b910ace883e08cbadcaa050666f.tar.bz2
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>
Diffstat (limited to 'package/base-files/files/lib')
-rwxr-xr-xpackage/base-files/files/lib/upgrade/stage25
1 files changed, 3 insertions, 2 deletions
diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2
index d7f92a4..3985d8f 100755
--- a/package/base-files/files/lib/upgrade/stage2
+++ b/package/base-files/files/lib/upgrade/stage2
@@ -84,6 +84,7 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
local loop="${2:-0}"
local run=true
local stat
+ local proc_ppid=$(cut -d' ' -f4 /proc/$$/stat)
echo -n "Sending $sig to remaining processes ... "
@@ -96,8 +97,8 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
read pid name state ppid rest < $stat
name="${name#(}"; name="${name%)}"
- # Skip PID1, ourself and our children
- [ $pid -ne 1 -a $pid -ne $$ -a $ppid -ne $$ ] || continue
+ # Skip PID1, our parent, ourself and our children
+ [ $pid -ne 1 -a $pid -ne $proc_ppid -a $pid -ne $$ -a $ppid -ne $$ ] || continue
local cmdline
read cmdline < /proc/$pid/cmdline