Skip to content

Commit

Permalink
CONC-416:
Browse files Browse the repository at this point in the history
Changed order for lookup configuration files on Windows:
1) GetSystemWindowsDirectory
2) GetSystemDirectory
3) Windows directory
4) C:\
  • Loading branch information
9EOR9 committed Jun 3, 2019
1 parent ca33724 commit dfa8b03
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions libmariadb/ma_default.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ static int add_cfg_dir(char **cfg_dirs, const char *directory)
{
int i;

for (i=0; i < MAX_CONFIG_DIRS && cfg_dirs[i]; i++);
for (i = 0; i < MAX_CONFIG_DIRS && cfg_dirs[i]; i++)
if (!strcmp(cfg_dirs[i], directory)) /* already present */
return 0;

if (i < MAX_CONFIG_DIRS) {
cfg_dirs[i]= strdup(directory);
Expand Down Expand Up @@ -82,11 +84,13 @@ char **get_default_configuration_dirs()

#ifdef _WIN32
/* On Windows operating systems configuration files are stored in
1. System directory
2. Windows directory
3. C:\
1. System Windows directory
2. System directory
3. Windows directory
4. C:\
*/
if (!GetSystemDirectory(dirname, FN_REFLEN) ||

if (!GetSystemWindowsDirectory(dirname, FN_REFLEN) ||
add_cfg_dir(configuration_dirs, dirname))
goto error;

Expand Down

0 comments on commit dfa8b03

Please sign in to comment.