mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
Bug#47216 programs should quit if the file specified by --defaults-file option isn't found
added code to exit a tool if the forced config file wasn't found per-file comments: client/mysql.cc Bug#47216 programs should quit if the file specified by --defaults-file option isn't found added code to exit a tool if the forced config file wasn't found client/mysql_upgrade.c Bug#47216 programs should quit if the file specified by --defaults-file option isn't found added code to exit a tool if the forced config file wasn't found client/mysqladmin.cc Bug#47216 programs should quit if the file specified by --defaults-file option isn't found added code to exit a tool if the forced config file wasn't found client/mysqlcheck.c Bug#47216 programs should quit if the file specified by --defaults-file option isn't found added code to exit a tool if the forced config file wasn't found client/mysqldump.c Bug#47216 programs should quit if the file specified by --defaults-file option isn't found added code to exit a tool if the forced config file wasn't found client/mysqlimport.c Bug#47216 programs should quit if the file specified by --defaults-file option isn't found added code to exit a tool if the forced config file wasn't found client/mysqlshow.c Bug#47216 programs should quit if the file specified by --defaults-file option isn't found added code to exit a tool if the forced config file wasn't found client/mysqlslap.c Bug#47216 programs should quit if the file specified by --defaults-file option isn't found added code to exit a tool if the forced config file wasn't found mysql-test/t/mysql.test Bug#47216 programs should quit if the file specified by --defaults-file option isn't found test added sql/mysqld.cc Bug#47216 programs should quit if the file specified by --defaults-file option isn't found added code to exit a tool if the forced config file wasn't found storage/myisam/myisamchk.c Bug#47216 programs should quit if the file specified by --defaults-file option isn't found added code to exit a tool if the forced config file wasn't found storage/myisam/myisampack.c Bug#47216 programs should quit if the file specified by --defaults-file option isn't found added code to exit a tool if the forced config file wasn't found
This commit is contained in:
parent
8f7f8b5a74
commit
760d42e7d0
18 changed files with 54 additions and 27 deletions
|
@ -1113,7 +1113,11 @@ int main(int argc,char *argv[])
|
||||||
close(stdout_fileno_copy); /* Clean up dup(). */
|
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;
|
defaults_argv=argv;
|
||||||
if (get_options(argc, (char **) argv))
|
if (get_options(argc, (char **) argv))
|
||||||
{
|
{
|
||||||
|
|
|
@ -814,7 +814,8 @@ int main(int argc, char **argv)
|
||||||
init_dynamic_string(&conn_args, "", 512, 256))
|
init_dynamic_string(&conn_args, "", 512, 256))
|
||||||
die("Out of memory");
|
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' */
|
defaults_argv= argv; /* Must be freed by 'free_defaults' */
|
||||||
|
|
||||||
if (handle_options(&argc, &argv, my_long_options, get_one_option))
|
if (handle_options(&argc, &argv, my_long_options, get_one_option))
|
||||||
|
|
|
@ -304,7 +304,8 @@ int main(int argc,char *argv[])
|
||||||
|
|
||||||
MY_INIT(argv[0]);
|
MY_INIT(argv[0]);
|
||||||
mysql_init(&mysql);
|
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 */
|
save_argv = argv; /* Save for free_defaults */
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1349,8 +1349,8 @@ static int parse_args(int *argc, char*** argv)
|
||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
result_file = stdout;
|
result_file = stdout;
|
||||||
load_defaults("my",load_default_groups,argc,argv);
|
if ((ho_error= load_defaults("my",load_default_groups,argc,argv)) ||
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
(ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
if (debug_info_flag)
|
if (debug_info_flag)
|
||||||
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
|
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
|
||||||
|
|
|
@ -344,9 +344,8 @@ static int get_options(int *argc, char ***argv)
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
load_defaults("my", load_default_groups, argc, argv);
|
if ((ho_error= load_defaults("my", load_default_groups, argc, argv)) ||
|
||||||
|
(ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
if (!what_to_do)
|
if (!what_to_do)
|
||||||
|
|
|
@ -858,7 +858,8 @@ static int get_options(int *argc, char ***argv)
|
||||||
opt_net_buffer_length= *mysql_params->p_net_buffer_length;
|
opt_net_buffer_length= *mysql_params->p_net_buffer_length;
|
||||||
|
|
||||||
md_result_file= stdout;
|
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;
|
defaults_argv= *argv;
|
||||||
|
|
||||||
if (hash_init(&ignore_table, charset_info, 16, 0, 0,
|
if (hash_init(&ignore_table, charset_info, 16, 0, 0,
|
||||||
|
|
|
@ -596,7 +596,8 @@ int main(int argc, char **argv)
|
||||||
char **argv_to_free;
|
char **argv_to_free;
|
||||||
MY_INIT(argv[0]);
|
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 is changed in the program */
|
||||||
argv_to_free= argv;
|
argv_to_free= argv;
|
||||||
if (get_options(&argc, &argv))
|
if (get_options(&argc, &argv))
|
||||||
|
|
|
@ -63,7 +63,9 @@ int main(int argc, char **argv)
|
||||||
char *wild;
|
char *wild;
|
||||||
MYSQL mysql;
|
MYSQL mysql;
|
||||||
MY_INIT(argv[0]);
|
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);
|
get_options(&argc,&argv);
|
||||||
|
|
||||||
wild=0;
|
wild=0;
|
||||||
|
|
|
@ -299,7 +299,11 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
MY_INIT(argv[0]);
|
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;
|
defaults_argv=argv;
|
||||||
if (get_options(&argc,&argv))
|
if (get_options(&argc,&argv))
|
||||||
{
|
{
|
||||||
|
|
|
@ -5931,7 +5931,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||||
|
|
||||||
int parse_args(int argc, char **argv)
|
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;
|
default_argv= argv;
|
||||||
|
|
||||||
if ((handle_options(&argc, &argv, my_long_options, get_one_option)))
|
if ((handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
|
|
|
@ -189,6 +189,7 @@ int main(int argc, char **argv)
|
||||||
config_file);
|
config_file);
|
||||||
}
|
}
|
||||||
error= 2;
|
error= 2;
|
||||||
|
exit(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (argument= arguments+1 ; *argument ; argument++)
|
for (argument= arguments+1 ; *argument ; argument++)
|
||||||
|
@ -196,5 +197,5 @@ int main(int argc, char **argv)
|
||||||
my_free((char*) load_default_groups,MYF(0));
|
my_free((char*) load_default_groups,MYF(0));
|
||||||
free_defaults(arguments);
|
free_defaults(arguments);
|
||||||
|
|
||||||
exit(error);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -479,9 +479,13 @@ int my_load_defaults(const char *conf_file, const char **groups,
|
||||||
ctx.args= &args;
|
ctx.args= &args;
|
||||||
ctx.group= &group;
|
ctx.group= &group;
|
||||||
|
|
||||||
error= my_search_option_files(conf_file, argc, argv, &args_used,
|
if ((error= my_search_option_files(conf_file, argc, argv, &args_used,
|
||||||
handle_default_option, (void *) &ctx,
|
handle_default_option, (void *) &ctx,
|
||||||
dirs);
|
dirs)))
|
||||||
|
{
|
||||||
|
free_root(&alloc,MYF(0));
|
||||||
|
DBUG_RETURN(error);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
Here error contains <> 0 only if we have a fully specified conf_file
|
Here error contains <> 0 only if we have a fully specified conf_file
|
||||||
or a forced default file
|
or a forced default file
|
||||||
|
@ -528,10 +532,10 @@ int my_load_defaults(const char *conf_file, const char **groups,
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error == 0 && default_directories)
|
if (default_directories)
|
||||||
*default_directories= dirs;
|
*default_directories= dirs;
|
||||||
|
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(0);
|
||||||
|
|
||||||
err:
|
err:
|
||||||
fprintf(stderr,"Fatal error in defaults handling. Program aborted\n");
|
fprintf(stderr,"Fatal error in defaults handling. Program aborted\n");
|
||||||
|
|
|
@ -3283,7 +3283,8 @@ static int init_common_variables(const char *conf_file_name, int argc,
|
||||||
|
|
||||||
orig_argc=argc;
|
orig_argc=argc;
|
||||||
orig_argv=argv;
|
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_argv=argv;
|
||||||
defaults_argc=argc;
|
defaults_argc=argc;
|
||||||
if (get_options(&defaults_argc, defaults_argv))
|
if (get_options(&defaults_argc, defaults_argv))
|
||||||
|
|
|
@ -390,7 +390,8 @@ static void print_version(void)
|
||||||
|
|
||||||
static void get_options(int *argc, char ***argv)
|
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;
|
default_argv= *argv;
|
||||||
|
|
||||||
handle_options(argc, argv, my_long_options, get_one_option);
|
handle_options(argc, argv, my_long_options, get_one_option);
|
||||||
|
|
|
@ -740,7 +740,9 @@ static void get_options(register int *argc,register char ***argv)
|
||||||
{
|
{
|
||||||
int ho_error;
|
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;
|
default_argv= *argv;
|
||||||
if (isatty(fileno(stdout)))
|
if (isatty(fileno(stdout)))
|
||||||
check_param.testflag|=T_WRITE_LOOP;
|
check_param.testflag|=T_WRITE_LOOP;
|
||||||
|
|
|
@ -208,7 +208,9 @@ int main(int argc, char **argv)
|
||||||
char **default_argv;
|
char **default_argv;
|
||||||
MY_INIT(argv[0]);
|
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;
|
default_argv= argv;
|
||||||
get_options(&argc,&argv);
|
get_options(&argc,&argv);
|
||||||
|
|
||||||
|
|
|
@ -18458,7 +18458,9 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
MY_INIT(argv[0]);
|
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;
|
defaults_argv= argv;
|
||||||
get_options(&argc, &argv);
|
get_options(&argc, &argv);
|
||||||
|
|
||||||
|
|
|
@ -176,9 +176,8 @@ static void get_options(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
load_defaults("my",load_default_groups,&argc,&argv);
|
if ((ho_error= load_defaults("my",load_default_groups,&argc,&argv)) ||
|
||||||
|
(ho_error= handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
free_defaults(argv);
|
free_defaults(argv);
|
||||||
|
|
Loading…
Reference in a new issue