#At file:///home/bzr/bugs/b57108-trunk-fixing/ based on revid:mats.kindahl@stripped
3330 Mats Kindahl 2010-11-10
Bug #58109: Function my_load_defaults() does not read
correct file
When passed an absolute filename, my_load_defaults()
is supposed to read only that file, but instead it
reads values from the defaults file found in a previous
execution of the function (which is saved in
my_defaults_file).
This patch fixes this by changing order of checks in
my_search_option_files() so that it first checks if an
absolute path was supplied, and in that case uses that
file only.
modified:
mysys/default.c
=== modified file 'mysys/default.c'
--- a/mysys/default.c 2010-11-05 15:12:46 +0000
+++ b/mysys/default.c 2010-11-10 11:48:00 +0000
@@ -279,7 +279,14 @@ int my_search_option_files(const char *c
group->type_names[group->count]= 0;
}
- if (my_defaults_file)
+ // If conf_file is an absolute path, we only read it
+ if (dirname_length(conf_file))
+ {
+ if ((error= search_default_file(func, func_ctx, NullS, conf_file)) < 0)
+ goto err;
+ }
+ // If my defaults file is set (from a previous run), we read it
+ else if (my_defaults_file)
{
if ((error= search_default_file_with_ext(func, func_ctx, "", "",
my_defaults_file, 0)) < 0)
@@ -291,11 +298,6 @@ int my_search_option_files(const char *c
goto err;
}
}
- else if (dirname_length(conf_file))
- {
- if ((error= search_default_file(func, func_ctx, NullS, conf_file)) < 0)
- goto err;
- }
else
{
for (dirs= default_directories ; *dirs; dirs++)
Attachment: [text/bzr-bundle] bzr/mats.kindahl@oracle.com-20101110114800-755c8lasm7vf9wzz.bundle