summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysql.cc6
-rw-r--r--client/mysql_upgrade.c3
-rw-r--r--client/mysqladmin.cc3
-rw-r--r--client/mysqlbinlog.cc4
-rw-r--r--client/mysqlcheck.c5
-rw-r--r--client/mysqldump.c3
-rw-r--r--client/mysqlimport.c3
-rw-r--r--client/mysqlshow.c4
-rw-r--r--client/mysqlslap.c6
-rw-r--r--client/mysqltest.cc4
-rw-r--r--extra/my_print_defaults.c3
-rw-r--r--mysys/default.c14
-rw-r--r--sql/mysqld.cc3
-rw-r--r--storage/archive/archive_reader.c3
-rw-r--r--storage/myisam/myisamchk.c4
-rw-r--r--storage/myisam/myisampack.c4
-rw-r--r--tests/mysql_client_test.c4
-rw-r--r--tests/thread_test.c5
18 files changed, 54 insertions, 27 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 28da6d75c1b..99ba42f20a8 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1113,7 +1113,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 52c3636219d..1634803edf5 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -814,7 +814,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 2b93c149523..cf8cf85a112 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 ebe34231238..80b0d2fc3d7 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -1349,8 +1349,8 @@ static int parse_args(int *argc, char*** argv)
int ho_error;
result_file = stdout;
- 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 (debug_info_flag)
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 1533e602639..b56016b6a35 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 e9e3124b9cb..16dcb53cae1 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 (hash_init(&ignore_table, charset_info, 16, 0, 0,
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index ef38d760e5d..53c889f0758 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -596,7 +596,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 15f791ca8fb..b6c8c5fc992 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 5983b911866..759a745cbe6 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 04a7e7b0c6f..ae3442a22a9 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -5931,7 +5931,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 06f7e51c380..11f8db97da1 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++)
@@ -196,5 +197,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 1c021b4584f..6cd01a193a0 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -479,9 +479,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
@@ -528,10 +532,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 896be4a7f19..4c070f53e23 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3283,7 +3283,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 9394b0df40b..078e95067a5 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -18458,7 +18458,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);