summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilly Tarreau <willy@wtap.(none)>2006-07-17 20:58:30 +0200
committerWilly Tarreau <willy@wtap.(none)>2006-07-26 12:04:04 +0200
commit9fdedbb89b96573f581bd3a4565649d848dfc2e0 (patch)
tree69c8acc40507ebab7857a0604259aff5413cfccf
parent[RELEASE] init-scripts-0.3.36 (diff)
downloadinit-scripts-9fdedbb89b96573f581bd3a4565649d848dfc2e0.tar.gz
* functions: svc_pidof must not check ppid if void
-rwxr-xr-xsbin/init.d/functions4
1 files changed, 3 insertions, 1 deletions
diff --git a/sbin/init.d/functions b/sbin/init.d/functions
index e2af4e2..bd847e3 100755
--- a/sbin/init.d/functions
+++ b/sbin/init.d/functions
@@ -124,6 +124,7 @@ function childrenpid {
# (ie: no pidfile used). Only processes which have ppid of 1 (or parent_pid)
# are returned. A list of pids to omit can be specified with "-o".
# If no process name is specified, all the parent's children are returned.
+# if "parent_pid" is empty, then the parent's pid is not checked.
# svc_pidof [ -o "omit_pids*" ]* [ -p parent_pid ] [ PNAME ... ]
function svc_pidof {
local omit=x
@@ -141,7 +142,7 @@ function svc_pidof {
#set -- "$( exec ps ahxo pid,ppid,comm )" ; set -- $( echo "$1" | awk '{ print $1,$2,$3}' )
set -- $( ps ahxo pid,ppid,comm | awk '{ print $1,$2,$3}' )
while [ $# -gt 0 ] ; do
- [ -z "${comm/* $3 */}" -a -n "${omit/* $1 */}" -a "$2" = "$ppid" ] && found="$found $1"
+ [ -z "${comm/* $3 */}" -a -n "${omit/* $1 */}" ] && [ -z "$ppid" -o "$2" = "$ppid" ] && found="$found $1"
shift ; shift ; shift
done
REPLY="" && [ "$found" ] && REPLY=$found && echo $REPLY
@@ -720,6 +721,7 @@ function default_service {
else
echo "Error: Unknown action : $ACTION"
fi
+ ((0)) # report an error
fi
fi
ret=$?