From 34a4d3062fd7243823b254c6fb047fa32daf797f Mon Sep 17 00:00:00 2001
From: Philip Withnall <philip.withnall@collabora.co.uk>
Date: Wed, 16 Mar 2016 11:12:11 +0000
Subject: [PATCH] ofono: Tighten pkill regexp for killing ofonod daemon at end
 of test
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The regexp is not bound to either end of the process name, so despite
the fact that the test script changed its effective process name to
‘ofonod_’, the regexp ‘ofonod’ still matches that, and hence the script
was killing itself, which was causing the systemd unit it was running as
to fail, and hence the overall test to fail.

Tighten the pkill regexp to match at the end of the process name to
avoid this.

Bug-Apertis: https://bugs.apertis.org/show_bug.cgi?id=681

Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: Philip Withnall <philip.withnall@collabora.co.uk>
Differential Revision: https://phabricator.apertis.org/D2284
---
 apparmor/ofono/ofonod | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apparmor/ofono/ofonod b/apparmor/ofono/ofonod
index 6f74803a..ddd28ef2 100755
--- a/apparmor/ofono/ofonod
+++ b/apparmor/ofono/ofonod
@@ -40,7 +40,7 @@ if [[ "$confinement" != "/usr/sbin/ofonod (enforce)" ]]; then
 fi
 
 sleep 5
-pkill -9 ofonod
+pkill -9 'ofonod$' || true
 
 systemctl start ofono.service
 
-- 
GitLab