1 --- ./rc.d/init.d/functions.orig Tue Oct 29 18:08:50 2002
2 +++ ./rc.d/init.d/functions Tue Oct 29 18:02:56 2002
4 # Marek Obuchowicz <elephant@pld.org.pl>
5 # Arkadiusz Mi¶kiewicz <misiek@pld.org.pl>
6 # Micha³ Kochanowicz <mkochano@pld.org.pl>
7 +# Mariusz Mazur <mmazur@pld.org.pl>
9 # First set up a default search path.
10 export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"
15 +# A function to filter out pids that are not in current chroot.
19 + # We don't test syntax since we can get zero parameters
22 + while [ $# -gt 0 ]; do
23 + rewt=$(resolvesymlink /proc/$1/root)
24 + if [ -n "$rewt" ]; then
25 + if [ "$rewt" = "/" ] || \
26 + [ "$rewt" = "/usr/share/empty" ] || \
27 + [ "$rewt" = "$CHROOT_TO_DIR" ]; then
28 + filteredpids="$filteredpids $1"
37 # A function to find the pid of a program.
41 # First try "/var/run/*.pid" files
42 if [ -f /var/run/$1.pid ] ; then
43 pid=$(head -1 /var/run/$1.pid)
44 + pid=$(filterchrooted $pid)
45 if [ -n "$pid" ] ; then
51 pid=$(pidof -o $$ -o $PPID -o %PPID -x $1)
52 + pid=$(filterchrooted $pid)
53 if [ -n "$pid" ] ; then
58 # Finally try to extract it from ps
59 - ps ax | awk 'BEGIN { prog=ARGV[1]; ARGC=1 }
60 + filterchrooted `ps ax | awk 'BEGIN { prog=ARGV[1]; ARGC=1 }
61 { if ((prog == $5) || (("(" prog ")") == $5) ||
62 (("[" prog "]") == $5) ||
63 - ((prog ":") == $5)) { print $1 ; exit 0 } }' $1
64 + ((prog ":") == $5)) { print $1 ; exit 0 } }' $1`
71 pid=$(pidof -o $$ -o $PPID -o %PPID -x $daemon)
72 + pid=$(filterchrooted $pid)
73 if [ -n "$pid" ] ; then
74 nls "%s (pid %s) is running..." "$daemon" "$pid"
77 { if ((prog == $5) || (("(" prog ")") == $5) ||
78 (("[" prog "]") == $5) ||
79 ((prog ":") == $5)) { print $1 ; exit 0 } }' $1`
80 + pid=$(filterchrooted $pid)
81 if [ "$pid" != "" ] ; then
82 nls "%s (pid %s) is running..." "$daemon" "$pid"
85 # Next try "/var/run/*.pid" files
86 if [ -f /var/run/$daemon.pid ] ; then
87 pid=$(head -1 /var/run/$1.pid)
88 + pid=$(filterchrooted $pid)
89 if [ -n "$pid" ] ; then
90 nls "%s dead but pid file exists" "$1"