commit:     9c6c5f0b52384dfe71ec3df833fbf7e9f3769663
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 13:08:49 2016 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Thu Mar  3 12:46:26 2016 +0000
URL:        https://gitweb.gentoo.org/proj/apache.git/commit/?id=9c6c5f0b

apache2.initd: capture config test output in checkconfig().

The configtest() command in the init script calls "apache2 -t" to test
the configuration for syntax errors. Before this commit, the command
was run twice -- once to see if there was an error, and once to output
the error to the user. We can capture the output in a variable the
first time; this commit does so, and prints the contents of that
variable when there is an error.

 2.4/init/apache2.initd | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/2.4/init/apache2.initd b/2.4/init/apache2.initd
index f86a31e..23d1746 100755
--- a/2.4/init/apache2.initd
+++ b/2.4/init/apache2.initd
@@ -61,11 +61,11 @@ checkconfig() {
        checkpath --directory /run/apache_ssl_mutex
        checkconfd || return 1
 
-       ${APACHE2} ${APACHE2_OPTS} -t 1>/dev/null 2>&1
+       OUTPUT=$( ${APACHE2} ${APACHE2_OPTS} -t 2>&1 )
        ret=$?
        if [ $ret -ne 0 ]; then
                eerror "${SVCNAME} has detected an error in your setup:"
-               ${APACHE2} ${APACHE2_OPTS} -t
+               printf "%s\n" "${OUTPUT}"
        fi
 
        return $ret

Reply via email to