functions: make __pids_var_run() dash compliant

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
Davide Madrisan 2012-01-13 22:33:27 +01:00
parent ad5e3b1014
commit ffc811b68b

View File

@ -95,9 +95,12 @@ __pids_var_run ()
pid=
if [ -f "$pid_file" ] ; then
local line p
[ -r "$pid_file" ] || return 4 # "user had insufficient privilege"
read line < "$pid_file"
for p in $line ; do
[ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p"
case $p in *[!0-9]*) : ;;
*) [ -d "/proc/$p" ] && pid="$pid $p" ;;
esac
done
if [ -n "$pid" ]; then
return 0