Commit 3e569727 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: unify --defaults* option handling

process all --defaults* options uniformly,
get rid of special case for --no-defaults and --print-defaults
use realpath instead of blindly concatenating pwd and relative path.
parent 3ea51b51
......@@ -146,16 +146,14 @@ int main(int argc, char **argv)
int count, error, args_used;
char **load_default_groups= 0, *tmp_arguments[6];
char **argument, **arguments, **org_argv;
char *defaults, *extra_defaults, *group_suffix;
int nargs, i= 0;
MY_INIT(argv[0]);
org_argv= argv;
args_used= get_defaults_options(argc, argv, &defaults, &extra_defaults,
&group_suffix);
args_used= get_defaults_options(argv);
/* Copy defaults-xxx arguments & program name */
count=args_used+1;
count=args_used;
arguments= tmp_arguments;
memcpy((char*) arguments, (char*) org_argv, count * sizeof(*org_argv));
arguments[count]= 0;
......
......@@ -26,9 +26,7 @@ extern const char *my_defaults_file;
extern my_bool my_getopt_use_args_separator;
extern my_bool my_getopt_is_args_separator(const char* arg);
extern int get_defaults_options(int argc, char **argv,
char **defaults, char **extra_defaults,
char **group_suffix);
extern int get_defaults_options(char **argv);
extern int my_load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv, const char ***);
extern int load_defaults(const char *conf_file, const char **groups,
......
......@@ -2,11 +2,11 @@ Could not open required defaults file: /path/with/no/extension
Fatal error in defaults handling. Program aborted
Could not open required defaults file: /path/with.ext
Fatal error in defaults handling. Program aborted
Could not open required defaults file: MYSQL_TEST_DIR/relative/path/with.ext
Could not open required defaults file: relative/path/with.ext
Fatal error in defaults handling. Program aborted
Could not open required defaults file: MYSQL_TEST_DIR/relative/path/without/extension
Could not open required defaults file: relative/path/without/extension
Fatal error in defaults handling. Program aborted
Could not open required defaults file: MYSQL_TEST_DIR/with.ext
Could not open required defaults file: with.ext
Fatal error in defaults handling. Program aborted
Could not open required defaults file: MYSQL_TEST_DIR/no_extension
Could not open required defaults file: no_extension
Fatal error in defaults handling. Program aborted
......@@ -13,19 +13,15 @@ exec $MYSQLD --defaults-file=/path/with/no/extension --print-defaults 2>&1;
--error 1
exec $MYSQLD --defaults-file=/path/with.ext --print-defaults 2>&1;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--error 1
exec $MYSQLD --defaults-file=relative/path/with.ext --print-defaults 2>&1;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--error 1
exec $MYSQLD --defaults-file=relative/path/without/extension --print-defaults 2>&1;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--error 1
exec $MYSQLD --defaults-file=with.ext --print-defaults 2>&1;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--error 1
exec $MYSQLD --defaults-file=no_extension --print-defaults 2>&1;
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment