1From c878a356712606549f7f188b62f7d1cae08a176e Mon Sep 17 00:00:00 2001
2From: Armin kuster <akuster808@gmail.com>
3Date: Wed, 14 Oct 2020 22:48:31 -0700
4Subject: [PATCH] Busybox does not support ps -p so use pgrep
5
6Upstream-Status: Inappropriate [embedded specific]
7Based on changes from Diego Sueiro <Diego.Sueiro@arm.com>
8
9Signed-off-by: Armin kuster <akuster808@gmail.com>
10
11---
12 src/bin/keactrl/keactrl.in | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
14
15diff --git a/src/bin/keactrl/keactrl.in b/src/bin/keactrl/keactrl.in
16index 450e997..c353ca9 100644
17--- a/src/bin/keactrl/keactrl.in
18+++ b/src/bin/keactrl/keactrl.in
19@@ -149,8 +149,8 @@ check_running() {
20     # Get the PID from the PID file (if it exists)
21     get_pid_from_file "${proc_name}"
22     if [ ${_pid} -gt 0 ]; then
23-        # Use ps to check if PID is alive
24-        if ps -p ${_pid} 1>/dev/null; then
25+        # Use pgrep and grep to check if PID is alive
26+        if pgrep -v 1 | grep ${_pid} 1>/dev/null; then
27             # No error, so PID IS ALIVE
28             _running=1
29         fi
30