summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authormonty@mysql.com <>2005-01-25 21:27:51 +0200
committermonty@mysql.com <>2005-01-25 21:27:51 +0200
commit37168015cd4a2135cfcfcd71478c066759fffd6a (patch)
treed9dcbad8d5c4fc3e392d04fe5c2ffe1598760471 /client
parent1ba93bd46edfd66753cd0c555a3f4c6873718bb0 (diff)
downloadmariadb-git-37168015cd4a2135cfcfcd71478c066759fffd6a.tar.gz
Cleanups during review
Diffstat (limited to 'client')
-rw-r--r--client/mysqlbinlog.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 7ddb01d9ec8..0b15ad893e2 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -687,7 +687,7 @@ static int parse_args(int *argc, char*** argv)
static MYSQL* safe_connect()
{
- MYSQL *local_mysql = mysql_init(NULL);
+ MYSQL *local_mysql= mysql_init(NULL);
if (!local_mysql)
die("Failed on mysql_init");
@@ -695,8 +695,12 @@ static MYSQL* safe_connect()
if (opt_protocol)
mysql_options(local_mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol);
if (!mysql_real_connect(local_mysql, host, user, pass, 0, port, sock, 0))
- die("failed on connect: %s", mysql_error(local_mysql));
-
+ {
+ char errmsg[256];
+ strmake(errmsg, mysql_error(local_mysql), sizeof(errmsg)-1);
+ mysql_close(local_mysql);
+ die("failed on connect: %s", errmsg);
+ }
return local_mysql;
}
@@ -717,7 +721,12 @@ static int check_master_version(MYSQL* mysql)
if (mysql_query(mysql, "SELECT VERSION()") ||
!(res = mysql_store_result(mysql)))
- die("Error checking master version: %s", mysql_error(mysql));
+ {
+ char errmsg[256];
+ strmake(errmsg, mysql_error(mysql), sizeof(errmsg)-1);
+ mysql_close(mysql);
+ die("Error checking master version: %s", errmsg);
+ }
if (!(row = mysql_fetch_row(res)))
{
mysql_free_result(res);