Commit 3c77a00d authored by Dan Ungureanu's avatar Dan Ungureanu Committed by Vicențiu Ciorbaru

MDEV-8012: Wrong exit code when asking for help

`--help` is a perfectly valid parameter and both `mysqladmin` and
`mysql_waitpid` should exit with success (zero errror code).
Signed-off-by: default avatarVicențiu Ciorbaru <vicentiu@mariadb.org>
parent 416006a3
...@@ -232,8 +232,6 @@ my_bool ...@@ -232,8 +232,6 @@ my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)), get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument) char *argument)
{ {
int error = 0;
switch(optid) { switch(optid) {
case 'c': case 'c':
opt_count_iterations= 1; opt_count_iterations= 1;
...@@ -281,8 +279,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -281,8 +279,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break; break;
case '?': case '?':
case 'I': /* Info */ case 'I': /* Info */
error++; usage();
break; exit(0);
case OPT_CHARSETS_DIR: case OPT_CHARSETS_DIR:
#if MYSQL_VERSION_ID > 32300 #if MYSQL_VERSION_ID > 32300
charsets_dir = argument; charsets_dir = argument;
...@@ -293,11 +291,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -293,11 +291,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt->name); opt->name);
break; break;
} }
if (error)
{
usage();
exit(1);
}
return 0; return 0;
} }
......
...@@ -54,6 +54,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -54,6 +54,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'I': case 'I':
case '?': case '?':
usage(); usage();
exit(0);
} }
return 0; return 0;
} }
...@@ -69,7 +70,10 @@ int main(int argc, char *argv[]) ...@@ -69,7 +70,10 @@ int main(int argc, char *argv[])
exit(-1); exit(-1);
if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 || if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 ||
(t= atoi(argv[1])) <= 0) (t= atoi(argv[1])) <= 0)
{
usage(); usage();
exit(-1);
}
for (; t > 0; t--) for (; t > 0; t--)
{ {
if (kill((pid_t) pid, sig)) if (kill((pid_t) pid, sig))
...@@ -100,5 +104,4 @@ void usage(void) ...@@ -100,5 +104,4 @@ void usage(void)
printf("integer arguments.\n\n"); printf("integer arguments.\n\n");
printf("Options:\n"); printf("Options:\n");
my_print_help(my_long_options); my_print_help(my_long_options);
exit(-1);
} }
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