summaryrefslogtreecommitdiff
path: root/sql/winservice.c
diff options
context:
space:
mode:
Diffstat (limited to 'sql/winservice.c')
-rw-r--r--sql/winservice.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/sql/winservice.c b/sql/winservice.c
index a11087e5cd5..d4e3bb0944d 100644
--- a/sql/winservice.c
+++ b/sql/winservice.c
@@ -134,6 +134,20 @@ static void get_datadir_from_ini(const char *ini, char *service_name, char *data
}
+static int fix_and_check_datadir(mysqld_service_properties *props)
+{
+ normalize_path(props->datadir, MAX_PATH);
+ /* Check if datadir really exists */
+ if (GetFileAttributes(props->datadir) != INVALID_FILE_ATTRIBUTES)
+ return 0;
+ /*
+ It is possible, that datadir contains some unconvertable character.
+ We just pretend not to know what's the data directory
+ */
+ props->datadir[0]= 0;
+ return 0;
+}
+
/*
Retrieve some properties from windows mysqld service binary path.
We're interested in ini file location and datadir, and also in version of
@@ -284,16 +298,9 @@ int get_mysql_service_properties(const wchar_t *bin_path,
}
}
- if (props->datadir[0])
- {
- normalize_path(props->datadir, MAX_PATH);
- /* Check if datadir really exists */
- if (GetFileAttributes(props->datadir) == INVALID_FILE_ATTRIBUTES)
- goto end;
- }
- else
+ if (props->datadir[0] == 0 || fix_and_check_datadir(props))
{
- /* There is no datadir in ini file, bail out.*/
+ /* There is no datadir in ini file, or non-existing dir, bail out.*/
goto end;
}