Bill,
How's this look?


svn diff Index: mpm_winnt.c =================================================================== --- mpm_winnt.c (revision 153937) +++ mpm_winnt.c (working copy) @@ -1071,7 +1071,8 @@ /* Handle the following SCM aspects in this phase: * * -k runservice [transition for WinNT, nothing for Win9x] - * -k (!)install [error out if name is not installed] + * -k install + * -k config * -k uninstall * -k stop * -k shutdown (same as -k stop). Maintained for backward compatability. @@ -1280,6 +1281,15 @@ "%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 */ + } } else if (running_as_service) { @@ -1325,6 +1335,15 @@ "No installed service named \"%s\".", service_name); exit(APEXIT_INIT); } + else if (!strcasecmp(signal_arg, "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 */ + }

     /* Track the args actually entered by the user.
      * These will be used for the -k install parameters, as well as
@@ -1387,8 +1406,8 @@

     /* Handle the following SCM aspects in this phase:
      *
-     *   -k install
-     *   -k config
+     *   -k install (catch and exit as install was handled in rewrite_args)
+     *   -k config  (catch and exit as config was handled in rewrite_args)
      *   -k start
      *   -k restart
      *   -k runservice [Win95, only once - after we parsed the config]
@@ -1399,18 +1418,23 @@
      * We reached this phase by avoiding errors that would cause
      * these options to fail unexpectedly in another process.
      */
-
     if (!strcasecmp(signal_arg, "install")) {
-        rv = mpm_service_install(ptemp, inst_argc, inst_argv, 0);
+        /* Service install happens in the rewrite_args hooks. If we
+         * made it this far, the server configuration is clean and the
+         * service will successfully start.
+         */
         apr_pool_destroy(s->process->pool);
         apr_terminate();
-        exit(rv);
+        exit(0);
     }
     if (!strcasecmp(signal_arg, "config")) {
-        rv = mpm_service_install(ptemp, inst_argc, inst_argv, 1);
+        /* Service reconfiguration happens in the rewrite_args hooks. If we
+         * made it this far, the server configuration is clean and the
+         * service will successfully start.
+         */
         apr_pool_destroy(s->process->pool);
         apr_terminate();
-        exit(rv);
+        exit(0);
     }

     if (!strcasecmp(signal_arg, "start")) {



Reply via email to