From: Mat Trudel Date: Tue, 7 Nov 2017 19:55:54 +0000 (+0100) Subject: sysupgrade: don't kill our own parent X-Git-Tag: v18.06.0-rc1~1735 X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fopenwrt.git;a=commitdiff_plain;h=2dca7177e75d2b910ace883e08cbadcaa050666f 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 Signed-off-by: John Crispin --- diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2 index d7f92a4f35..3985d8fd7e 100755 --- a/package/base-files/files/lib/upgrade/stage2 +++ b/package/base-files/files/lib/upgrade/stage2 @@ -84,6 +84,7 @@ kill_remaining() { # [ [ ] ] 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() { # [ [ ] ] 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