From 23c14db17c85676192c2952637bfe39a10294ba2 Mon Sep 17 00:00:00 2001 From: Didier Raboud Date: Mon, 19 Mar 2012 17:09:40 +0100 Subject: [PATCH] Make init-functions' status_of_proc return the LSB-documented 3 on inexistant pidfiles. This enhances the 13f38d30a823afc5841fd17ee405c6ebff2af1ac commit by additionally taking the potential inexistance of pidfiles into account. Closes: #664621 Reported-by: Michael Prokop Signed-off-by: Didier Raboud --- init-functions | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init-functions b/init-functions index d5b6971..35ed7eb 100644 --- a/init-functions +++ b/init-functions @@ -82,6 +82,7 @@ pidofproc () { fi if [ -n "${pidfile:-}" ]; then + if [ -e "$pidfile" ]; then if [ -r "$pidfile" ]; then read pid < "$pidfile" if [ -n "${pid:-}" ]; then @@ -98,6 +99,9 @@ pidofproc () { else return 4 # pid file not readable, hence status is unknown. fi + else + return 3 # pid file doesn't exist, program probably stopped + fi fi if [ -x /bin/pidof ] && [ ! "$specified" ]; then status="0" -- 2.30.2