]> granicus.if.org Git - apache/commitdiff
Solve the -k start bug [thanks for the pointers, FirstBill!]
authorWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 5 Jun 2002 15:46:30 +0000 (15:46 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 5 Jun 2002 15:46:30 +0000 (15:46 +0000)
  The answer was really trivial.  Unlike all other cases where you
  expect to send argv[0] and get argv[0] in the created process,
  the service control manager (SCM) just don't work like that.

  StartService() argv passed must not include an element zero.
  Element zero is inserted by the SCM, containing the service name,
  without any help from the outside.

  Only reason this bug 'appeared' is that Jeff's patch introduced
  a bit of strictness to refuse arguments without a flag.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95526 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/winnt/service.c

index 93cfe5da29908aab022f3a622cc0479472187b25..4c99ea74fc02ecf3ad7d22f8596ce3fa15a22942 100644 (file)
@@ -1057,11 +1057,8 @@ apr_status_t mpm_service_start(apr_pool_t *ptemp, int argc,
             return 0;
         }
         
-        argc += 1;
         start_argv = malloc((argc + 1) * sizeof(const char **));
-        start_argv[0] = mpm_service_name;
-        if (argc > 1)
-            memcpy(start_argv + 1, argv, (argc - 1) * sizeof(const char **));
+        memcpy(start_argv, argv, argc * sizeof(const char **));
         start_argv[argc] = NULL;
 
         rv = APR_EINIT;