diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2020-07-01 18:43:21 +0200 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2020-07-01 18:43:21 +0200 |
commit | 41b0d98e69740f6d894a369a83efbbe5f7bffdfd (patch) | |
tree | 20c0d5cf08f0683bd33dc58017bccf92d0929615 | |
parent | fe05c16c8d6d9ff90186578cdc3db460469e4fe1 (diff) | |
download | mariadb-git-41b0d98e69740f6d894a369a83efbbe5f7bffdfd.tar.gz |
MDEV-23067 Windows : manually registered services rejected mysql_upgrade_service
- service not using "--defaults-file" can have any name not just "MySQL"
- service with "--defaults-file", without datadir in them
use default datadir (install_root\data)
-rw-r--r-- | sql/winservice.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/sql/winservice.c b/sql/winservice.c index d9605f3a6c4..fe1fb0cb2bb 100644 --- a/sql/winservice.c +++ b/sql/winservice.c @@ -150,10 +150,7 @@ int get_mysql_service_properties(const wchar_t *bin_path, There are rare cases where service config does not have --defaults-filein the binary parth . There services were registered with plain mysqld --install, the data directory is next to "bin" in this case. - Service name (second parameter) must be MySQL. */ - if(wcscmp(args[1], L"MySQL") != 0) - goto end; have_inifile= FALSE; } else if(numargs == 3) @@ -211,7 +208,7 @@ int get_mysql_service_properties(const wchar_t *bin_path, } } - if(!have_inifile) + if(!have_inifile || props->datadir[0] == 0) { /* Hard, although a rare case, we're guessing datadir and defaults-file. @@ -235,22 +232,25 @@ int get_mysql_service_properties(const wchar_t *bin_path, *p= 0; } - /* Look for my.ini, my.cnf in the install root */ - sprintf_s(props->inifile, MAX_PATH, "%s\\my.ini", install_root); - if (GetFileAttributes(props->inifile) == INVALID_FILE_ATTRIBUTES) - { - sprintf_s(props->inifile, MAX_PATH, "%s\\my.cnf", install_root); - } - if (GetFileAttributes(props->inifile) != INVALID_FILE_ATTRIBUTES) - { - /* Ini file found, get datadir from there */ - GetPrivateProfileString("mysqld", "datadir", NULL, props->datadir, - MAX_PATH, props->inifile); - } - else + if (!have_inifile) { - /* No ini file */ - props->inifile[0]= 0; + /* Look for my.ini, my.cnf in the install root */ + sprintf_s(props->inifile, MAX_PATH, "%s\\my.ini", install_root); + if (GetFileAttributes(props->inifile) == INVALID_FILE_ATTRIBUTES) + { + sprintf_s(props->inifile, MAX_PATH, "%s\\my.cnf", install_root); + } + if (GetFileAttributes(props->inifile) != INVALID_FILE_ATTRIBUTES) + { + /* Ini file found, get datadir from there */ + GetPrivateProfileString("mysqld", "datadir", NULL, props->datadir, + MAX_PATH, props->inifile); + } + else + { + /* No ini file */ + props->inifile[0]= 0; + } } /* Try datadir in install directory.*/ |