diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-07-02 06:05:13 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-07-02 06:05:13 +0300 |
commit | dba7e1e8e14254c9de61e74b7e68cdbbad0038a8 (patch) | |
tree | 466788daf4b9cdb9125c6fe96789e2abb0746157 /sql/winservice.c | |
parent | 838a1046b247e0c70089d3b5cf609c0a40fa3e4b (diff) | |
parent | c43a666662ac71e70bde83e6673ebcb2811887af (diff) | |
download | mariadb-git-dba7e1e8e14254c9de61e74b7e68cdbbad0038a8.tar.gz |
Merge 10.1 into 10.2
Diffstat (limited to 'sql/winservice.c')
-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 ceab83f50ee..2d5cf62b53d 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.*/ |