diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-07-02 06:17:51 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-07-02 06:17:51 +0300 |
commit | 1df1a6392477ad211b2a66c6eccbe9d5c6316c7e (patch) | |
tree | 7f38ad7d6e69ea53fb9c887ff9aaa953f103ea54 /sql/winservice.c | |
parent | 6d3747a294d75ab8153f82c5b2d61c3bf17b04de (diff) | |
parent | dba7e1e8e14254c9de61e74b7e68cdbbad0038a8 (diff) | |
download | mariadb-git-1df1a6392477ad211b2a66c6eccbe9d5c6316c7e.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'sql/winservice.c')
-rw-r--r-- | sql/winservice.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/sql/winservice.c b/sql/winservice.c index 3c9d07822be..c275e6d99c8 100644 --- a/sql/winservice.c +++ b/sql/winservice.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2011, 2012, Monty Program Ab + Copyright (c) 2011, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -148,13 +148,10 @@ int get_mysql_service_properties(const wchar_t *bin_path, { /* There are rare cases where service config does not have - --defaults-file in the binary parth . There services were + --defaults-file in the binary path . 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. + next to "bin" in this case. */ - if (wcscmp(args[1], L"MySQL") != 0) - goto end; have_inifile= FALSE; } else if(numargs == 3) @@ -212,7 +209,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. @@ -236,22 +233,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.*/ |