diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-05-23 08:59:03 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-05-23 08:59:03 +0300 |
commit | b61700c22104b513caa9a85e5c6529aa5f2bf4e4 (patch) | |
tree | 23f776bd41e4388241ebb43eb8102ca6d36d1b4a /client/mysqladmin.cc | |
parent | 70df2bef7acffed1e7da21ba7b9c644a32e36f3a (diff) | |
parent | 725e47bfb524f4b1d29076c8777056bedd5f00ea (diff) | |
download | mariadb-git-b61700c22104b513caa9a85e5c6529aa5f2bf4e4.tar.gz |
Merge 10.0 into 10.1
Diffstat (limited to 'client/mysqladmin.cc')
-rw-r--r-- | client/mysqladmin.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index aa6a188166d..e6b904eb26e 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -614,6 +614,7 @@ static my_bool sql_connect(MYSQL *mysql, uint wait) static int execute_commands(MYSQL *mysql,int argc, char **argv) { + int ret = 0; const char *status; /* MySQL documentation relies on the fact that mysqladmin will @@ -1104,7 +1105,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) if (strcmp(typed_password, verified) != 0) { my_printf_error(0,"Passwords don't match",MYF(ME_BELL)); - return -1; + ret = -1; + goto password_done; } } else @@ -1131,7 +1133,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) { my_printf_error(0, "Could not determine old_passwords setting from server; error: '%s'", error_flags, mysql_error(mysql)); - return -1; + ret = -1; + goto password_done; } else { @@ -1142,7 +1145,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) "Could not get old_passwords setting from " "server; error: '%s'", error_flags, mysql_error(mysql)); - return -1; + ret = -1; + goto password_done; } if (!mysql_num_rows(res)) old= 1; @@ -1167,15 +1171,15 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) { my_printf_error(0, "Can't turn off logging; error: '%s'", error_flags, mysql_error(mysql)); - return -1; + ret = -1; } + else if (mysql_query(mysql,buff)) { if (mysql_errno(mysql)!=1290) { my_printf_error(0,"unable to change password; error: '%s'", error_flags, mysql_error(mysql)); - return -1; } else { @@ -1189,9 +1193,10 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) " --skip-grant-tables).\n" "Use: \"mysqladmin flush-privileges password '*'\"" " instead", error_flags); - return -1; } + ret = -1; } +password_done: /* free up memory from prompted password */ if (typed_password != argv[1]) { @@ -1293,7 +1298,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) return 1; } } - return 0; + return ret; } /** |