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
# 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