Skip to contentSkip to conversation

weston-init: fix killproc for thinlinux so that it doesn't kill itself

PATCH New Darren Etheridge 1 participant 1 message May 2, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 weston-init: fix killproc for thinlinux so that it doesn't kill itself

busybox pidof doesn't omit the current pid as this script is called weston on the target in thinlinux with a busybox based utility load later killproc operations end up killing this script, which leads to the script not actually starting weston.

---
 .../recipes-graphics/wayland/weston-init/init   | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
meta-arago-distro/recipes-graphics/wayland/weston-init/init +15 -2
index 461b0787..1f55ab76 100644
@@ -9,8 +9,21 @@
 ### END INIT INFO
 
 killproc() {
-        pid=`/bin/pidof $1`
-        [ "$pid" != "" ] && kill $pid
+	all_pids=`/bin/pidof $1`
+
+	# busybox pidof doesn't ommit the current pid
+	# as this script is called weston on the target
+	# in thinlinux with a busybox based utility load
+	# later killproc operations end up killing this
+	# script.
+	for pid in $all_pids
+	do
+		if [ "$pid" != "$$" ]; then
+			kill_pids+=$pid
+		fi
+	done
+
+	[ "$kill_pids" != "" ] && kill $kill_pids
 }
 
 read CMDLINE < /proc/cmdline
Signature · 1 line
2.17.1