summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <ram@gw.mysql.r18.ru>2004-09-08 16:45:03 +0500
committerunknown <ram@gw.mysql.r18.ru>2004-09-08 16:45:03 +0500
commiteed990d667df9caac808b17cea3b9eb67af1e33d (patch)
tree08a2c8ac6bde1162f16b1626a8b0e9d512203042 /client
parent419ca7152f30c6cbb8c8e8c4920a3d6e90e076a8 (diff)
downloadmariadb-git-eed990d667df9caac808b17cea3b9eb67af1e33d.tar.gz
A fix (bug #3120: 'mysqladmin ping' - return error code).
Diffstat (limited to 'client')
-rw-r--r--client/mysqladmin.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/client/mysqladmin.c b/client/mysqladmin.c
index 3bc11ec0fb0..153fcdde96d 100644
--- a/client/mysqladmin.c
+++ b/client/mysqladmin.c
@@ -246,7 +246,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
int main(int argc,char *argv[])
{
- int error, ho_error;
+ int error= 0, ho_error;
MYSQL mysql;
char **commands, **save_argv;
@@ -285,10 +285,25 @@ int main(int argc,char *argv[])
opt_ssl_capath, opt_ssl_cipher);
#endif
if (sql_connect(&mysql, option_wait))
- error = 1;
+ {
+ unsigned int err= mysql_errno(&mysql);
+ if (err >= CR_MIN_ERROR && err <= CR_MAX_ERROR)
+ error= 1;
+ else
+ {
+ /* Return 0 if all commands are PING */
+ for (; argc > 0; argv++, argc--)
+ {
+ if (find_type(argv[0], &command_typelib, 2) != ADMIN_PING)
+ {
+ error= 1;
+ break;
+ }
+ }
+ }
+ }
else
{
- error = 0;
while (!interrupted && (!opt_count_iterations || nr_iterations))
{
new_line = 0;