[apache2] 02/02: Fix race condition and logical error in init script
Stefan Fritsch
sf at moszumanska.debian.org
Sat May 28 09:24:52 UTC 2016
This is an automated email from the git hooks/post-receive script.
sf pushed a commit to branch master
in repository apache2.
commit 9030f8b0232d3ecb6489bc13cc10f8134c670f7f
Author: Stefan Fritsch <sf at sfritsch.de>
Date: Sat May 28 11:13:06 2016 +0200
Fix race condition and logical error in init script
---
debian/apache2.init | 15 ++++++++++-----
debian/changelog | 2 ++
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/debian/apache2.init b/debian/apache2.init
index 8b6a876..1f51d9e 100755
--- a/debian/apache2.init
+++ b/debian/apache2.init
@@ -120,6 +120,7 @@ apache_wait_start() {
apache_wait_stop() {
local STATUS=$1
+ local METH=$2
if [ $STATUS != 0 ] ; then
return $STATUS
@@ -127,11 +128,17 @@ apache_wait_stop() {
PIDTMP=$(pidofproc -p $PIDFILE $DAEMON)
if [ -n "${PIDTMP:-}" ] && kill -0 "${PIDTMP:-}" 2> /dev/null; then
+ if [ "$METH" = "kill" ]; then
+ killproc -p $PIDFILE $DAEMON
+ else
+ $APACHE2CTL $METH > /dev/null 2>&1
+ fi
+
local i=0
while kill -0 "${PIDTMP:-}" 2> /dev/null; do
if [ $i = '60' ]; then
- break
STATUS=2
+ break
fi
[ "$VERBOSE" != no ] && log_progress_msg "."
sleep 1
@@ -204,15 +211,13 @@ do_stop()
fi
if [ $AP_RET = 2 ] && apache_conftest ; then
- $APACHE2CTL $STOP > /dev/null 2>&1
- apache_wait_stop $?
+ apache_wait_stop $? $STOP
return $?
else
if [ $AP_RET = 2 ]; then
clear_error_msg
APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX configtest failed, so we are trying to kill it manually. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now!"
- killproc -p $PIDFILE $DAEMON
- apache_wait_stop $?
+ apache_wait_stop $? "kill"
return $?
elif [ $AP_RET = 1 ] ; then
APACHE2_INIT_MESSAGE="There are processes named 'apache2' running which do not match your pid file which are left untouched in the name of safety, Please review the situation by hand".
diff --git a/debian/changelog b/debian/changelog
index 7c3aa9e..4525f7c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ apache2 (2.4.20-2) UNRELEASED; urgency=medium
* Fix crash in ap_get_useragent_host() triggered by mod_perl test.
Closes: #820824
+ * Fix race condition and logical error in init script. Thanks to Thomas
+ Stangner for the patch. Closes: #822144
-- Stefan Fritsch <sf at debian.org> Sat, 28 May 2016 10:58:26 +0200
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-apache/apache2.git
More information about the Pkg-apache-commits
mailing list