diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-05-23 11:09:47 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-05-23 11:09:47 +0300 |
commit | 8f643e2063c9890a353149f39ef85b2cf3151fd0 (patch) | |
tree | c5468b905c8858dc1cc80ccb2072a923b28c8783 /client/mysqladmin.cc | |
parent | 3aecedb2f8f99c446a5ba0b02efcf422a252c9e8 (diff) | |
parent | b61700c22104b513caa9a85e5c6529aa5f2bf4e4 (diff) | |
download | mariadb-git-8f643e2063c9890a353149f39ef85b2cf3151fd0.tar.gz |
Merge 10.1 into 10.2
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 1eba3f25ee8..6a5ac0a2611 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -616,6 +616,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 @@ -1106,7 +1107,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 @@ -1133,7 +1135,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 { @@ -1144,7 +1147,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; @@ -1169,15 +1173,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 { @@ -1191,9 +1195,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]) { @@ -1300,7 +1305,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) return 1; } } - return 0; + return ret; } /** |