Commit 4583ebf1 authored by unknown's avatar unknown

cleaned up mysql installation code for windows.

This removes a (small) memory leak.


sql/nt_servc.h:
  Indentation change
parent 0348c816
...@@ -3299,12 +3299,14 @@ default_service_handling(char **argv, ...@@ -3299,12 +3299,14 @@ default_service_handling(char **argv,
if (Service.got_service_option(argv, "install")) if (Service.got_service_option(argv, "install"))
{ {
Service.Install(1, servicename, displayname, path_and_service, account_name); Service.Install(1, servicename, displayname, path_and_service,
account_name);
return 0; return 0;
} }
if (Service.got_service_option(argv, "install-manual")) if (Service.got_service_option(argv, "install-manual"))
{ {
Service.Install(0, servicename, displayname, path_and_service, account_name); Service.Install(0, servicename, displayname, path_and_service,
account_name);
return 0; return 0;
} }
if (Service.got_service_option(argv, "remove")) if (Service.got_service_option(argv, "remove"))
...@@ -3324,7 +3326,7 @@ int main(int argc, char **argv) ...@@ -3324,7 +3326,7 @@ int main(int argc, char **argv)
application PID e.g.: MySQLShutdown1890; MySQLShutdown2342 application PID e.g.: MySQLShutdown1890; MySQLShutdown2342
*/ */
int10_to_str((int) GetCurrentProcessId(),strmov(shutdown_event_name, int10_to_str((int) GetCurrentProcessId(),strmov(shutdown_event_name,
"MySQLShutdown"), 10); "MySQLShutdown"), 10);
/* Must be initialized early for comparison of service name */ /* Must be initialized early for comparison of service name */
system_charset_info= &my_charset_utf8_general_ci; system_charset_info= &my_charset_utf8_general_ci;
...@@ -3358,7 +3360,8 @@ int main(int argc, char **argv) ...@@ -3358,7 +3360,8 @@ int main(int argc, char **argv)
} }
else if (argc == 3) /* install or remove any optional service */ else if (argc == 3) /* install or remove any optional service */
{ {
if (!default_service_handling(argv, argv[2], argv[2], file_path, "", NULL)) if (!default_service_handling(argv, argv[2], argv[2], file_path, "",
NULL))
return 0; return 0;
if (Service.IsService(argv[2])) if (Service.IsService(argv[2]))
{ {
...@@ -3385,24 +3388,20 @@ int main(int argc, char **argv) ...@@ -3385,24 +3388,20 @@ int main(int argc, char **argv)
--defaults-file=file, but that was not enforced in 4.1, so we don't --defaults-file=file, but that was not enforced in 4.1, so we don't
enforce it here.) enforce it here.)
*/ */
char *extra_opt= NULL; const char *extra_opt= NullS;
char *account_name = NULL; const char *account_name = NullS;
int index; int index;
for (index = 3; index < argc; index++) for (index = 3; index < argc; index++)
{ {
if (strncmp(argv[index], "--local-service", 15) == 0) if (!strcmp(argv[index], "--local-service"))
{ account_name= "NT AUTHORITY\\LocalService";
account_name=(char*)malloc(27);
strmov(account_name, "NT AUTHORITY\\LocalService\0");
}
else else
{
extra_opt= argv[index]; extra_opt= argv[index];
}
} }
if (argc != 5 || account_name) if (argc == 4 || account_name)
if (!default_service_handling(argv, argv[2], argv[2], file_path, extra_opt, account_name)) if (!default_service_handling(argv, argv[2], argv[2], file_path,
extra_opt, account_name))
return 0; return 0;
} }
else if (argc == 1 && Service.IsService(MYSQL_SERVICENAME)) else if (argc == 1 && Service.IsService(MYSQL_SERVICENAME))
......
...@@ -48,8 +48,9 @@ class NTService ...@@ -48,8 +48,9 @@ class NTService
//service install / un-install //service install / un-install
BOOL Install(int startType,LPCSTR szInternName,LPCSTR szDisplayName,LPCSTR szFullPath, BOOL Install(int startType,LPCSTR szInternName,LPCSTR szDisplayName,
LPCSTR szAccountName=NULL,LPCSTR szPassword=NULL); LPCSTR szFullPath, LPCSTR szAccountName=NULL,
LPCSTR szPassword=NULL);
BOOL SeekStatus(LPCSTR szInternName, int OperationType); BOOL SeekStatus(LPCSTR szInternName, int OperationType);
BOOL Remove(LPCSTR szInternName); BOOL Remove(LPCSTR szInternName);
BOOL IsService(LPCSTR ServiceName); BOOL IsService(LPCSTR ServiceName);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment