aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2010-04-26 13:13:39 -0400
committerBill Nottingham <notting@redhat.com>2010-04-26 13:13:39 -0400
commitde8b2aed329ea2e3c087bc25764fc1779a83fafc (patch)
treedefc8b7f4abfbe3a8ffb704d173499cd79789216
parent8c84461bc433b0cc0cf4299d4b3f0a143719a677 (diff)
downloadinitscripts-de8b2aed329ea2e3c087bc25764fc1779a83fafc.tar
initscripts-de8b2aed329ea2e3c087bc25764fc1779a83fafc.tar.gz
initscripts-de8b2aed329ea2e3c087bc25764fc1779a83fafc.tar.bz2
initscripts-de8b2aed329ea2e3c087bc25764fc1779a83fafc.tar.xz
initscripts-de8b2aed329ea2e3c087bc25764fc1779a83fafc.zip
Handle being unable to read a specified pid file. (#584575)
-rw-r--r--rc.d/init.d/functions10
1 files changed, 8 insertions, 2 deletions
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.