summaryrefslogtreecommitdiff
path: root/extra/my_print_defaults.c
diff options
context:
space:
mode:
Diffstat (limited to 'extra/my_print_defaults.c')
-rw-r--r--extra/my_print_defaults.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c
index 7695f669b1f..cb883a60f85 100644
--- a/extra/my_print_defaults.c
+++ b/extra/my_print_defaults.c
@@ -98,6 +98,11 @@ static struct my_option my_long_options[] =
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
+void cleanup_and_exit(int exit_code)
+{
+ my_end(0);
+ exit(exit_code);
+}
static void version()
{
@@ -116,7 +121,7 @@ static void usage()
my_print_default_files(config_file);
my_print_variables(my_long_options);
printf("\nExample usage:\n%s --defaults-file=example.cnf client client-server mysql\n", my_progname);
- exit(0);
+ cleanup_and_exit(0);
}
@@ -129,7 +134,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_defaults_file_used= 1;
break;
case 'n':
- exit(0);
+ cleanup_and_exit(0);
case 'I':
case '?':
usage();
@@ -179,7 +184,7 @@ int main(int argc, char **argv)
/* Check out the args */
if (get_options(&argc,&argv))
- exit(1);
+ cleanup_and_exit(1);
nargs= argc + 1;
if (opt_mysqld)