From: Peter Eisentraut Date: Wed, 7 Mar 2012 10:33:43 +0000 (+0100) Subject: Handle non-world-readable pid files. X-Git-Tag: archive/raspbian/10.2018112800+rpi1^2~163 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=13f38d30a823afc5841fd17ee405c6ebff2af1ac;p=lsb.git Handle non-world-readable pid files. Closes: #653598 Reported-by: Peter Eisentraut Signed-off-by: Didier Raboud --- diff --git a/init-functions b/init-functions index 8b14cf7..c646073 100644 --- a/init-functions +++ b/init-functions @@ -81,7 +81,8 @@ pidofproc () { pidfile="/var/run/$base.pid" fi - if [ -n "${pidfile:-}" ] && [ -r "$pidfile" ]; then + if [ -n "${pidfile:-}" ]; then + if [ -r "$pidfile" ]; then read pid < "$pidfile" if [ -n "${pid:-}" ]; then if $(kill -0 "${pid:-}" 2> /dev/null); then @@ -94,6 +95,9 @@ pidofproc () { return 1 # program is dead and /var/run pid file exists fi fi + else + return 4 # pid file not readable, hence status is unknown. + fi fi if [ -x /bin/pidof ] && [ ! "$specified" ]; then status="0"