Bug#359217: exit statement and test logic in init.d/apache2
Package: apache-common
Version: 2.0.54-5
Severity: normal
Tags: patch
1.
In /etc/init.d on line 76 it says that the script is supposed to
exit automagically, but the code responsible goes like this (line 78):
PIDS=`pidof apache2` || true
and the return value will not be checked later so i suggest it was
intended to be:
PIDS=`pidof apache2` || exit
2.
I suggest to change the test at line 48 to check for the $PID itself
instead for checking the $PIDFILE that has allready be verified some
lines above:
if [ -n $PID ]
intead of:
if [ -e "$PIDFILE" ]
--- apache2.orig 2005-09-05 16:23:42.000000000 +0200
+++ apache2 2006-03-27 13:14:20.400228312 +0200
@@ -45,10 +45,8 @@
if `apache2 -t > /dev/null 2>&1`; then
# if the config is ok than we just stop normaly
- if [ -e "$PIDFILE" ]
+ if [ -n $PID ]
then
- PID=`cat $PIDFILE`
-
$APACHE2 -k stop
CNT=0
@@ -68,7 +66,7 @@
sleep 1
done
else
- echo -n " ... no pidfile found! not running?"
+ echo -n " ... pid not found! not running?"
fi
else
@@ -77,7 +75,7 @@
# if pidof is null for some reasons the script exits automagically
# classified as good/unknown feature
- PIDS=`pidof apache2` || true
+ PIDS=`pidof apache2` || exit
REALPID=0
# if there is a pid we need to verify that belongs to apache2
Reply to: