diff options
-rw-r--r-- | client/mysql.cc | 6 | ||||
-rw-r--r-- | client/mysql_upgrade.c | 3 | ||||
-rw-r--r-- | client/mysqladmin.cc | 3 | ||||
-rw-r--r-- | client/mysqlbinlog.cc | 3 | ||||
-rw-r--r-- | client/mysqlcheck.c | 5 | ||||
-rw-r--r-- | client/mysqldump.c | 3 | ||||
-rw-r--r-- | client/mysqlimport.c | 3 | ||||
-rw-r--r-- | client/mysqlshow.c | 4 | ||||
-rw-r--r-- | client/mysqlslap.c | 6 | ||||
-rw-r--r-- | client/mysqltest.cc | 4 | ||||
-rw-r--r-- | extra/my_print_defaults.c | 3 | ||||
-rw-r--r-- | mysys/default.c | 14 | ||||
-rw-r--r-- | sql/mysqld.cc | 3 | ||||
-rw-r--r-- | storage/archive/archive_reader.c | 3 | ||||
-rw-r--r-- | storage/myisam/myisamchk.c | 4 | ||||
-rw-r--r-- | storage/myisam/myisampack.c | 4 | ||||
-rw-r--r-- | tests/mysql_client_test.c | 4 | ||||
-rw-r--r-- | tests/thread_test.c | 5 |
18 files changed, 54 insertions, 26 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 3fa416330e8..04cca1a2615 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1114,7 +1114,11 @@ int main(int argc,char *argv[]) close(stdout_fileno_copy); /* Clean up dup(). */ } - load_defaults("my",load_default_groups,&argc,&argv); + if (load_defaults("my",load_default_groups,&argc,&argv)) + { + my_end(0); + exit(1); + } defaults_argv=argv; if (get_options(argc, (char **) argv)) { diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 05eb80e5455..1a3f61559d6 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -819,7 +819,8 @@ int main(int argc, char **argv) init_dynamic_string(&conn_args, "", 512, 256)) die("Out of memory"); - load_defaults("my", load_default_groups, &argc, &argv); + if (load_defaults("my", load_default_groups, &argc, &argv)) + die(NULL); defaults_argv= argv; /* Must be freed by 'free_defaults' */ if (handle_options(&argc, &argv, my_long_options, get_one_option)) diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index a3eee14e0d1..c8cbafe72d9 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -304,7 +304,8 @@ int main(int argc,char *argv[]) MY_INIT(argv[0]); mysql_init(&mysql); - load_defaults("my",load_default_groups,&argc,&argv); + if (load_defaults("my",load_default_groups,&argc,&argv)) + exit(1); save_argv = argv; /* Save for free_defaults */ if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) { diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index f87f5b92f10..196d355f1dc 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -2014,7 +2014,8 @@ int main(int argc, char** argv) my_init_time(); // for time functions - load_defaults("my", load_default_groups, &argc, &argv); + if (load_defaults("my", load_default_groups, &argc, &argv)) + exit(1); defaults_argv= argv; parse_args(&argc, (char***)&argv); diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 1affea1d189..252ee500cf6 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -344,9 +344,8 @@ static int get_options(int *argc, char ***argv) exit(0); } - load_defaults("my", load_default_groups, argc, argv); - - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + if ((ho_error= load_defaults("my", load_default_groups, argc, argv)) || + (ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); if (!what_to_do) diff --git a/client/mysqldump.c b/client/mysqldump.c index aa81a0e98bf..54e7d68e191 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -858,7 +858,8 @@ static int get_options(int *argc, char ***argv) opt_net_buffer_length= *mysql_params->p_net_buffer_length; md_result_file= stdout; - load_defaults("my",load_default_groups,argc,argv); + if (load_defaults("my",load_default_groups,argc,argv)) + return 1; defaults_argv= *argv; if (my_hash_init(&ignore_table, charset_info, 16, 0, 0, diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 5b8ec95c06d..867663db8be 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -592,7 +592,8 @@ int main(int argc, char **argv) char **argv_to_free; MY_INIT(argv[0]); - load_defaults("my",load_default_groups,&argc,&argv); + if (load_defaults("my",load_default_groups,&argc,&argv)) + return 1; /* argv is changed in the program */ argv_to_free= argv; if (get_options(&argc, &argv)) diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 206b86d07cf..588ee049546 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -63,7 +63,9 @@ int main(int argc, char **argv) char *wild; MYSQL mysql; MY_INIT(argv[0]); - load_defaults("my",load_default_groups,&argc,&argv); + if (load_defaults("my",load_default_groups,&argc,&argv)) + exit(1); + get_options(&argc,&argv); wild=0; diff --git a/client/mysqlslap.c b/client/mysqlslap.c index f13b5099766..fcfd525bba7 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -299,7 +299,11 @@ int main(int argc, char **argv) MY_INIT(argv[0]); - load_defaults("my",load_default_groups,&argc,&argv); + if (load_defaults("my",load_default_groups,&argc,&argv)) + { + my_end(0); + exit(1); + } defaults_argv=argv; if (get_options(&argc,&argv)) { diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 04a3526139e..89330b0e31d 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -5956,7 +5956,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), int parse_args(int argc, char **argv) { - load_defaults("my",load_default_groups,&argc,&argv); + if (load_defaults("my",load_default_groups,&argc,&argv)) + exit(1); + default_argv= argv; if ((handle_options(&argc, &argv, my_long_options, get_one_option))) diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index 42a5cbd6877..2614946a712 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -189,6 +189,7 @@ int main(int argc, char **argv) config_file); } error= 2; + exit(error); } for (argument= arguments+1 ; *argument ; argument++) @@ -197,5 +198,5 @@ int main(int argc, char **argv) my_free((char*) load_default_groups,MYF(0)); free_defaults(arguments); - exit(error); + exit(0); } diff --git a/mysys/default.c b/mysys/default.c index 6468cf2b35d..f7c18ed83eb 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -503,9 +503,13 @@ int my_load_defaults(const char *conf_file, const char **groups, ctx.args= &args; ctx.group= &group; - error= my_search_option_files(conf_file, argc, argv, &args_used, - handle_default_option, (void *) &ctx, - dirs); + if ((error= my_search_option_files(conf_file, argc, argv, &args_used, + handle_default_option, (void *) &ctx, + dirs))) + { + free_root(&alloc,MYF(0)); + DBUG_RETURN(error); + } /* Here error contains <> 0 only if we have a fully specified conf_file or a forced default file @@ -557,10 +561,10 @@ int my_load_defaults(const char *conf_file, const char **groups, exit(0); } - if (error == 0 && default_directories) + if (default_directories) *default_directories= dirs; - DBUG_RETURN(error); + DBUG_RETURN(0); err: fprintf(stderr,"Fatal error in defaults handling. Program aborted\n"); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 0e922beabe2..3a3eee9737d 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3242,7 +3242,8 @@ static int init_common_variables(const char *conf_file_name, int argc, orig_argc=argc; orig_argv=argv; - load_defaults(conf_file_name, groups, &argc, &argv); + if (load_defaults(conf_file_name, groups, &argc, &argv)) + return 1; defaults_argv=argv; defaults_argc=argc; if (get_options(&defaults_argc, defaults_argv)) diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c index 84d4e318b49..0d641de3e15 100644 --- a/storage/archive/archive_reader.c +++ b/storage/archive/archive_reader.c @@ -390,7 +390,8 @@ static void print_version(void) static void get_options(int *argc, char ***argv) { - load_defaults("my", load_default_groups, argc, argv); + if (load_defaults("my", load_default_groups, argc, argv)) + exit(1); default_argv= *argv; handle_options(argc, argv, my_long_options, get_one_option); diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 611fb6325c8..de0e53e6a36 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -740,7 +740,9 @@ static void get_options(register int *argc,register char ***argv) { int ho_error; - load_defaults("my", load_default_groups, argc, argv); + if (load_defaults("my", load_default_groups, argc, argv)) + exit(1); + default_argv= *argv; if (isatty(fileno(stdout))) check_param.testflag|=T_WRITE_LOOP; diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index 908c32e48d3..9ebd11b2516 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -208,7 +208,9 @@ int main(int argc, char **argv) char **default_argv; MY_INIT(argv[0]); - load_defaults("my",load_default_groups,&argc,&argv); + if (load_defaults("my",load_default_groups,&argc,&argv)) + exit(1); + default_argv= argv; get_options(&argc,&argv); diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index cfe401c75f3..e2721415092 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -19280,7 +19280,9 @@ int main(int argc, char **argv) MY_INIT(argv[0]); - load_defaults("my", client_test_load_default_groups, &argc, &argv); + if (load_defaults("my", client_test_load_default_groups, &argc, &argv)) + exit(1); + defaults_argv= argv; get_options(&argc, &argv); diff --git a/tests/thread_test.c b/tests/thread_test.c index 8e1c58ebbec..5b76eeff2f7 100644 --- a/tests/thread_test.c +++ b/tests/thread_test.c @@ -176,9 +176,8 @@ static void get_options(int argc, char **argv) { int ho_error; - load_defaults("my",load_default_groups,&argc,&argv); - - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) + if ((ho_error= load_defaults("my",load_default_groups,&argc,&argv)) || + (ho_error= handle_options(&argc, &argv, my_long_options, get_one_option))) exit(ho_error); free_defaults(argv); |