summaryrefslogtreecommitdiff
path: root/sql/winservice.c
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@montyprogram.com>2011-02-15 13:04:55 +0100
committerVladislav Vaintroub <wlad@montyprogram.com>2011-02-15 13:04:55 +0100
commit7ac23980b8009c7d446b008208f1bd6ba6ae9839 (patch)
treecaa9dee1d54b06f2365e1e85417ebcd14458786b /sql/winservice.c
parent3ec6533ac8e583c7bf6fd1c04ca5aef1a6950e46 (diff)
downloadmariadb-git-7ac23980b8009c7d446b008208f1bd6ba6ae9839.tar.gz
MWL#55 : Philip's review:
Take into account that mysql services start even with invalid defaults files (using data file relative to mysqld.exe location). Handle this case in upgrade scenarios, as if there was no --defaults-file in service definition.
Diffstat (limited to 'sql/winservice.c')
-rw-r--r--sql/winservice.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/sql/winservice.c b/sql/winservice.c
index 1cbe5e906e8..562f047fa79 100644
--- a/sql/winservice.c
+++ b/sql/winservice.c
@@ -130,17 +130,30 @@ int get_mysql_service_properties(const wchar_t *bin_path,
get_file_version(props->mysqld_exe, &props->version_major,
&props->version_minor, &props->version_patch);
}
+
if (have_inifile)
{
- /* Easy case, we have --defaults-file in service definition. */
+ /* We have --defaults-file in service definition. */
wcstombs(props->inifile, args[1]+16, MAX_PATH);
normalize_path(props->inifile, MAX_PATH);
- if (GetFileAttributes(props->inifile) == INVALID_FILE_ATTRIBUTES)
- goto end;
- GetPrivateProfileString("mysqld", "datadir", NULL, props->datadir, MAX_PATH,
- props->inifile);
+ if (GetFileAttributes(props->inifile) != INVALID_FILE_ATTRIBUTES)
+ {
+ GetPrivateProfileString("mysqld", "datadir", NULL, props->datadir, MAX_PATH,
+ props->inifile);
+ }
+ else
+ {
+ /*
+ Service will start even with invalid .ini file, using lookup for
+ datadir relative to mysqld.exe. This is equivalent to the case no ini
+ file used.
+ */
+ props->inifile[0]= 0;
+ have_inifile= FALSE;
+ }
}
- else
+
+ if(!have_inifile)
{
/*
Hard, although a rare case, we're guessing datadir and defaults-file.