]> git.pld-linux.org Git - projects/rc-scripts.git/blobdiff - lib/functions
fix 12 year old bug in pidofproc
[projects/rc-scripts.git] / lib / functions
index d7d5e9d19f5de0e30d99d54c3ee2cec8b0709baa..5d6dfbdd61c6a627ea22d76c325d88d2cb757f35 100644 (file)
@@ -981,14 +981,17 @@ pidofproc() {
                *) pidfile="/var/run/$pidfile";;
        esac
        if [ -f "${pidfile}" ]; then
-               local p pid=""
+               local p
                for p in $(< "${pidfile}"); do
                        [ -z "$(echo "$p" | awk '{gsub(/[0-9]/,"");print;}')" ] && pid="$pid $p"
                done
        fi
 
-       # Next try "pidof"
-       [ -z "$pid" ] && pidof -o $$ -o $PPID -o %PPID -x "$1"
+       if [ -z "$pid" ]; then
+               # Next try "pidof"
+               pid=$(pidof -o $$ -o $PPID -o %PPID -x "$1")
+       fi
+
        pid=$(filter_chroot $pid)
        echo $pid
 }
This page took 0.043992 seconds and 4 git commands to generate.