From: William A. Rowe Jr Date: Tue, 26 Mar 2002 20:13:37 +0000 (+0000) Subject: Somewhere about server/main.c rev 1.54, we lost the stop|shutdown|uninstall X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3a3b4a20191e289c53cbbc45e950ee18caf922c9;p=apache Somewhere about server/main.c rev 1.54, we lost the stop|shutdown|uninstall when the .conf file is missing or horribly corrupt. Move those actions into the rewrite args phase so we don't trip over a missing .conf file, we couldn't care less if we are stopping/uninstalling Apache. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94189 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index e800bae9b1..b1ed742803 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -1936,9 +1936,15 @@ void winnt_rewrite_args(process_rec *process) * * -k runservice [transition for WinNT, nothing for Win9x] * -k (!)install [error out if name is not installed] + * -k uninstall + * -k stop + * -k shutdown (same as -k stop). Maintained for backward compatability. * * We can't leave this phase until we know our identity * and modify the command arguments appropriately. + * + * We do not care if the .conf file exists or is parsable when + * attempting to stop or uninstall a service. */ apr_status_t rv; char *def_server_root; @@ -2108,6 +2114,20 @@ void winnt_rewrite_args(process_rec *process) { if (service_set == APR_SUCCESS) { + /* Attempt to Uninstall, or stop, before + * we can read the arguments or .conf files + */ + if (!strcasecmp(signal_arg, "uninstall")) { + rv = mpm_service_uninstall(); + exit(rv); + } + + if ((!strcasecmp(signal_arg, "stop")) || + (!strcasecmp(signal_arg, "shutdown"))) { + mpm_signal_service(process->pool, 0); + exit(0); + } + rv = mpm_merge_service_args(process->pool, mpm_new_argv, fixed_args); if (rv == APR_SUCCESS) { @@ -2152,13 +2172,7 @@ static int winnt_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pte /* Handle the following SCM aspects in this phase: * * -k runservice [WinNT errors logged from rewrite_args] - * -k uninstall - * -k stop - * -k shutdown (same as -k stop). Maintained for backward compatability. - * - * in these cases we -don't- care if httpd.conf has config errors! */ - apr_status_t rv; if (ap_exists_config_define("ONE_PROCESS") || ap_exists_config_define("DEBUG")) @@ -2173,17 +2187,6 @@ static int winnt_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pte exit(APEXIT_INIT); } - if (!strcasecmp(signal_arg, "uninstall")) { - rv = mpm_service_uninstall(); - exit(rv); - } - - if ((!strcasecmp(signal_arg, "stop")) || - (!strcasecmp(signal_arg, "shutdown"))) { - mpm_signal_service(ptemp, 0); - exit(0); - } - ap_listen_pre_config(); ap_threads_per_child = DEFAULT_START_THREAD; ap_pid_fname = DEFAULT_PIDLOG;