Commit ba315223 authored by unknown's avatar unknown
Browse files

Restore behavior of 4.1 that allowed any one argument to be passed to the

server on Windows service startup, and not just --defaults-file=file. This
appears to be an unnecessary limitation, but fixing that will require
a larger refactoring of the Windows service installation and startup code.
(Bug #7856)


sql/mysqld.cc:
  Restore behavior from 4.1 of allowing any one parameter to the service on
  install, and not just --defaults-file=file.
parent 1c49d548
Loading
Loading
Loading
Loading
+16 −21
Original line number Diff line number Diff line
@@ -3375,37 +3375,32 @@ int main(int argc, char **argv)
	return 0;
      }
    }
    else if (argc >= 4)
    else if (argc == 4 || argc == 5)
    {
      const char *defaults_file = "--defaults-file";
      const char *service = "--local-service";
      char extra_opt[FN_REFLEN] = "";  
      /*
        This may seem strange, because we handle --local-service while
        preserving 4.1's behavior of allowing any one other argument that is
        passed to the service on startup. (The assumption is that this is
        --defaults-file=file, but that was not enforced in 4.1, so we don't
        enforce it here.)
      */
      char *extra_opt= NULL;
      char *account_name = NULL;
      char *option;
      int index;
      for (index = 3; index < argc; index++)
      {
        option= argv[index];
        /* 
          Install an optional service with optional config file
          mysqld --install-manual mysqldopt --defaults-file=c:\miguel\my.ini
        */
        if (strncmp(option, defaults_file, strlen(defaults_file)) == 0)
        if (strncmp(argv[index], "--local-service", 15) == 0)
        {
          strmov(extra_opt, option);	  
          account_name=(char*)malloc(27);
          strmov(account_name, "NT AUTHORITY\\LocalService\0");
        }
        else
        /* 
          Install an optional service as local service
          mysqld --install-manual mysqldopt --local-service
        */
        if (strncmp(option, service, strlen(service)) == 0)
        {
          account_name=(char*)malloc(27);
          strmov(account_name, "NT AUTHORITY\\LocalService\0");
          extra_opt= argv[index];
        }
      }

      if (argc != 5 || account_name)
        if (!default_service_handling(argv, argv[2], argv[2], file_path, extra_opt, account_name))
          return 0;
    }