From 8af9f738b1e7d8a21c2102872f8c02167dd1d201 Mon Sep 17 00:00:00 2001 From: Bill Stoddard Date: Tue, 1 Mar 2005 22:38:04 +0000 Subject: [PATCH] Win32: Init the args to mpm_service_install(). Prevents nasty things like segfaults git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@155833 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/winnt/mpm_winnt.c | 48 +++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index d4b4f1c308..565edb3ac9 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -1283,17 +1283,6 @@ void winnt_rewrite_args(process_rec *process) "%s: Service is already installed.", service_name); exit(APEXIT_INIT); } - else - { - /* Install the service */ - rv = mpm_service_install(process->pool, inst_argc, inst_argv, 0); - if (rv != APR_SUCCESS) { - exit(rv); - } - /* Proceed to post_config in order to test the installed configuration */ - fprintf(stderr,"Testing httpd.conf....\n"); - fprintf(stderr,"Errors reported here must be corrected before the service can be started.\n"); - } } else if (running_as_service) { @@ -1339,24 +1328,39 @@ void winnt_rewrite_args(process_rec *process) "No installed service named \"%s\".", service_name); exit(APEXIT_INIT); } - else if (!strcasecmp(signal_arg, "config")) - { + + /* Track the args actually entered by the user. + * These will be used for the -k install parameters, as well as + * for the -k start service override arguments. + */ + inst_argv = (const char * const *)mpm_new_argv->elts + + mpm_new_argv->nelts - inst_argc; + + /* Now, do service install or reconfigure then proceed to + * post_config to test the installed configuration. + */ + if (!strcasecmp(signal_arg, "config")) { /* -k config */ /* Reconfigure the service */ rv = mpm_service_install(process->pool, inst_argc, inst_argv, 1); if (rv != APR_SUCCESS) { exit(rv); } - /* Proceed to post_config in order to test the installed configuration */ + fprintf(stderr,"Testing httpd.conf....\n"); - fprintf(stderr,"Errors reported here must be corrected before the service can be started.\n"); + fprintf(stderr,"Errors reported here must be corrected before the " + "service can be started.\n"); + } + else if (!strcasecmp(signal_arg, "install")) { /* -k install */ + /* Install the service */ + rv = mpm_service_install(process->pool, inst_argc, inst_argv, 0); + if (rv != APR_SUCCESS) { + exit(rv); + } + + fprintf(stderr,"Testing httpd.conf....\n"); + fprintf(stderr,"Errors reported here must be corrected before the " + "service can be started.\n"); } - - /* Track the args actually entered by the user. - * These will be used for the -k install parameters, as well as - * for the -k start service override arguments. - */ - inst_argv = (const char * const *)mpm_new_argv->elts - + mpm_new_argv->nelts - inst_argc; process->argc = mpm_new_argv->nelts; process->argv = (const char * const *) mpm_new_argv->elts; -- 2.40.0