From 88e04b794024c4350e9925ec5a2f879244fe70c0 Mon Sep 17 00:00:00 2001 From: Harald Dunkel Date: Sun, 24 Mar 2019 14:24:13 +0100 Subject: pidofproc: use "pidof -c" to avoid pidofproc results from containers or chroots From pidof's manpage: -c Only return process PIDs that are running with the same root directory. This option is ignored for non-root users, as they will be unable to check the current root directory of processes they do not own. Closes: #888743 --- init-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init-functions b/init-functions index 252da64..207b270 100644 --- a/init-functions +++ b/init-functions @@ -107,7 +107,7 @@ pidofproc () { # pid file doesn't exist, try to find the pid nevertheless if [ -x /bin/pidof ] && [ ! "$specified" ]; then status="0" - /bin/pidof -o %PPID -x $1 || status="$?" + /bin/pidof -c -o %PPID -x $1 || status="$?" if [ "$status" = 1 ]; then return 3 # program is not running fi -- cgit v1.2.3