From 4634757c03b8b257f809fade3311bd5b8e57af92 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 21 Jan 2016 10:36:36 -0500 Subject: apache2.initd: append STARTUPERRORLOG to APACHE2_OPTS in start(). We currently append the value of STARTUPERRORLOG to APACHE2_OPTS in the checkconfd() function. This can cause duplication of command-line arguments as witnessed in bug 566726. Since STARTUPERRORLOG does need conditional handling (we don't append it if it's empty), the wisest place to do so seems to be in start(). Gentoo-Bug: 566726 --- 2.4/init/apache2.initd | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/2.4/init/apache2.initd b/2.4/init/apache2.initd index e493f05..6320f1a 100755 --- a/2.4/init/apache2.initd +++ b/2.4/init/apache2.initd @@ -45,8 +45,6 @@ checkconfd() { APACHE2_OPTS="${APACHE2_OPTS} -d ${SERVERROOT}" APACHE2_OPTS="${APACHE2_OPTS} -f ${CONFIGFILE}" - [ -n "${STARTUPERRORLOG}" ] && APACHE2_OPTS="${APACHE2_OPTS} -E ${STARTUPERRORLOG}" - } checkconfig() { @@ -66,6 +64,13 @@ checkconfig() { start() { checkconfig || return 1 + if [ -n "${STARTUPERRORLOG}" ] ; then + # We must make sure that we only append to APACHE2_OPTS + # in start() and not in stop() or anywhere else that may + # be executed along with start(), see bug #566726. + APACHE2_OPTS="${APACHE2_OPTS} -E ${STARTUPERRORLOG}" + fi + ebegin "Starting ${SVCNAME}" # Use start stop daemon to apply system limits #347301 start-stop-daemon --start -- ${APACHE2} ${APACHE2_OPTS} -k start -- cgit v1.2.3-65-gdbad