diff options
author | Alexey Botchkov <holyfoot@mysql.com> | 2010-10-08 12:09:47 +0500 |
---|---|---|
committer | Alexey Botchkov <holyfoot@mysql.com> | 2010-10-08 12:09:47 +0500 |
commit | 6adb077efc36ef068826aea8050d615e71fa450f (patch) | |
tree | 118721c53ef03f1c9d92ea6b5a9175946397d9c4 /client/mysqlcheck.c | |
parent | 96c99602d4ef2b67b15ec5fb5676ad1a45e9a805 (diff) | |
download | mariadb-git-6adb077efc36ef068826aea8050d615e71fa450f.tar.gz |
Bug#35269 mysqlcheck behaves different depending on order of parameters
Issue an error if user specifies multiple commands to run.
Also there was an unnoticed bug that DO_CHECK was actually 0 which lead
to wrong actions in some cases.
The mysqlcheck.test contained commands with the suspicious meaning
for the above reason. Extra commands removed from there.
per-file commands:
client/mysqlcheck.c
Bug#35269 mysqlcheck behaves different depending on order of parameters
Drop with an error if multiple commands.
mysql-test/r/mysqlcheck.result
Bug#35269 mysqlcheck behaves different depending on order of parameters
result completed.
mysql-test/t/mysqlcheck.test
Bug#35269 mysqlcheck behaves different depending on order of parameters
testcase added.
not-working commands removed from some mysqlcheck calls.
Diffstat (limited to 'client/mysqlcheck.c')
-rw-r--r-- | client/mysqlcheck.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index aebe80b9ba6..7b188d7ce18 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -47,7 +47,7 @@ static char *shared_memory_base_name=0; #endif static uint opt_protocol=0; -enum operations { DO_CHECK, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_UPGRADE }; +enum operations { DO_CHECK=1, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_UPGRADE }; static struct my_option my_long_options[] = { @@ -241,6 +241,8 @@ static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { + int orig_what_to_do= what_to_do; + switch(optid) { case 'a': what_to_do = DO_ANALYZE; @@ -315,6 +317,13 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt->name); break; } + + if (orig_what_to_do && (what_to_do != orig_what_to_do)) + { + fprintf(stderr, "Error: %s doesn't support multiple contradicting commands.\n", + my_progname); + return 1; + } return 0; } |