You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "William A. Rowe, Jr." <wr...@rowe-clan.net> on 2002/06/05 18:17:17 UTC
Re: cvs commit: httpd-2.0/server/mpm/winnt service.c
Examining apache-1.3/src/os/win32/service.c:1401 we already excluded argv[0]
in our apache 1.3 code, so no backport is required.
>wrowe 2002/06/05 08:46:30
>
> Modified: server/mpm/winnt service.c
> Log:
> Solve the -k start bug [thanks for the pointers, FirstBill!]
>
> 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.
>
> Revision Changes Path
> 1.53 +1 -4 httpd-2.0/server/mpm/winnt/service.c
>
> Index: service.c
> ===================================================================
> RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/service.c,v
> retrieving revision 1.52
> retrieving revision 1.53
> diff -u -r1.52 -r1.53
> --- service.c 5 Jun 2002 15:14:33 -0000 1.52
> +++ service.c 5 Jun 2002 15:46:30 -0000 1.53
> @@ -1057,11 +1057,8 @@
> 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;
>
>
>