httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Stoddard <b...@wstoddard.com>
Subject Re: [PATCH] Win32: install service in rewrite args rather than post_config?
Date Tue, 15 Feb 2005 20:18:36 GMT
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")) {


Mime
View raw message