From de8b2aed329ea2e3c087bc25764fc1779a83fafc Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 26 Apr 2010 13:13:39 -0400 Subject: Handle being unable to read a specified pid file. (#584575) --- rc.d/init.d/functions | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'rc.d/init.d') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 2000d4af..d36310b4 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -153,6 +153,7 @@ __pids_var_run() { if [ -f "$pid_file" ] ; then local line p + [ ! -r "$pid_file" ] && return 4 # "user had insufficient privilege" while : ; do read line [ -z "$line" ] && break @@ -294,8 +295,13 @@ killproc() { # Find pid. __pids_var_run "$1" "$pid_file" - if [ -z "$pid_file" -a -z "$pid" ]; then - pid="$(__pids_pidof "$1")" + RC=$? + if [ -z "$pid" ]; then + if [ -z "$pid_file" ]; then + pid="$(__pids_pidof "$1")" + else + [ "$RC" = "4" ] && { failure $"$base shutdown" ; return $RC ;} + fi fi # Kill it. -- cgit v1.2.1