> -----Original Message-----
> From: William A. Rowe, Jr. [mailto:[EMAIL PROTECTED]]
> Sent: 14. lipanj 2002 9:18
> To: Cliff Woolley
> Cc: [EMAIL PROTECTED]
> Subject: Re: [Bug 9858] New: - ApacheMonitor can not start
> service due to bug in service.c or ApacheMonitor.c (fwd)
>
>
> This is the same bug as winnt's mpm that Jeff Trawick's -k
> patch introduced, we used to ignore this accidental
> non-switch 'parameter' but the parsing change showed this up as a bug.
>
> I'll let Mladen author the patch and apply later today :-)
> The answer is pretty trivial, we simply shouldn't have ever
> provided an argv[0] to the StartService call. The old
> parsers [1.3/2.0] both overlooked this bug.
>
Yes, now that I look that don't know why did I even done all that arg
parsing...
It works even without args :-).
If doesn't theN just replace the line 775 with the args[0] = NULL;
MT.
Index: ApacheMonitor.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/support/win32/ApacheMonitor.c,v
retrieving revision 1.18
diff -u -3 -r1.18 ApacheMonitor.c
--- ApacheMonitor.c 19 Apr 2002 19:19:44 -0000 1.18
+++ ApacheMonitor.c 14 Jun 2002 07:40:46 -0000
@@ -667,7 +667,6 @@
SC_HANDLE schService;
SC_HANDLE schSCManager;
SERVICE_STATUS schSStatus;
- LPSTR *args;
int ticks;
if (g_dwOSVersion == OS_VERSION_WIN9X)
@@ -717,17 +716,6 @@
}
else
{
- /* Apache 2.0 uses '-k runservice' as cmdline parameter */
- sPos = strstr(szImagePath, "--ntservice");
- if (!sPos)
- {
- sPos = strstr(szImagePath, "-k runservice");
- serviceFlag = FALSE;
- }
- if (sPos)
- lstrcpyn(szBuf, szImagePath, sPos - szImagePath);
- else
- return FALSE;
schSCManager = OpenSCManager(
szComputerName,
NULL,
@@ -771,16 +759,8 @@
case SERVICE_CONTROL_CONTINUE:
sprintf(szMsg, g_lpMsg[IDS_MSG_SRVSTART-IDS_MSG_FIRST],
szServiceName);
addListBoxString(g_hwndStdoutList, szMsg);
- args = (char **)malloc(3 * sizeof(char*));
- args[0] = szBuf;
- if (serviceFlag)
- args[1] = "--ntservice";
- else
- {
- args[1] = "-k";
- args[2] = "runservice";
- }
- if (StartService(schService, serviceFlag ? 2 : 3, args))
+
+ if (StartService(schService, 0, NULL))
{
Sleep(1000);
while (QueryServiceStatus(schService, &schSStatus))
@@ -800,8 +780,6 @@
addListBoxString(g_hwndStdoutList, szMsg);
}
}
- /* is this OK to do? */
- free(args);
break;
case SERVICE_APACHE_RESTART:
sprintf(szMsg, g_lpMsg[IDS_MSG_SRVRESTART-IDS_MSG_FIRST],
szServiceName);