]> granicus.if.org Git - apache/commitdiff
Win32: Init the args to mpm_service_install(). Prevents nasty things like segfaults
authorBill Stoddard <stoddard@apache.org>
Tue, 1 Mar 2005 22:38:04 +0000 (22:38 +0000)
committerBill Stoddard <stoddard@apache.org>
Tue, 1 Mar 2005 22:38:04 +0000 (22:38 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@155833 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/winnt/mpm_winnt.c

index d4b4f1c30890c48f6b030c1968e436d56d8f9925..565edb3ac971f254f05c552f598beebc0eaf257d 100644 (file)
@@ -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;