aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/init.d
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2008-12-01 13:57:33 -0500
committerBill Nottingham <notting@redhat.com>2008-12-01 13:57:33 -0500
commitd8d067e3e2c6492fa16d6290e7b5fbb9a9e0b745 (patch)
tree3de65b5b0f1e31a0e2d92c6e360857fbc7d440f3 /rc.d/init.d
parent8526b5c44655b71484ba5458ef489bd60efdbd1b (diff)
downloadinitscripts-d8d067e3e2c6492fa16d6290e7b5fbb9a9e0b745.tar
initscripts-d8d067e3e2c6492fa16d6290e7b5fbb9a9e0b745.tar.gz
initscripts-d8d067e3e2c6492fa16d6290e7b5fbb9a9e0b745.tar.bz2
initscripts-d8d067e3e2c6492fa16d6290e7b5fbb9a9e0b745.tar.xz
initscripts-d8d067e3e2c6492fa16d6290e7b5fbb9a9e0b745.zip
__pids_var_run: Handle multi-line pid files correctly (#473287)
We were only reading the first line of pid files. Given that even those first lines could have multiple pids, this *shouldn't* break anything, but there may be some scripts with multi-line pid files that aren't expecting this.
Diffstat (limited to 'rc.d/init.d')
-rw-r--r--rc.d/init.d/functions13
1 files changed, 9 insertions, 4 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index acef3321..bb580486 100644
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -152,10 +152,15 @@ __pids_var_run() {
pid=
if [ -f "$pid_file" ] ; then
local line p
- read line < "$pid_file"
- for p in $line ; do
- [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p"
- done
+
+ while : ; do
+ read line
+ [ -z "$line" ] && break
+ for p in $line ; do
+ [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p"
+ done
+ done < "$pid_file"
+
if [ -n "$pid" ]; then
return 0
fi