diff options
author | Magne Mahre <magne.mahre@sun.com> | 2009-10-09 14:30:54 +0200 |
---|---|---|
committer | Magne Mahre <magne.mahre@sun.com> | 2009-10-09 14:30:54 +0200 |
commit | c9248c642453b827c6631c5b76340db72f2f7236 (patch) | |
tree | 8f8dd0cfacbee48a877f1bfaf64adf44dab3767a /sql-common | |
parent | f0195faf88830fce9515fb148a3bc970fd39c52b (diff) | |
download | mariadb-git-c9248c642453b827c6631c5b76340db72f2f7236.tar.gz |
Bug #33831 mysql_real_connect() connects again if
given an already connected MYSQL handle
mysql_real_connect() did not check whether the MYSQL connection
handler was already connected and connected again even if so.
Now a CR_ALREADY_CONNECTED error is returned.
Diffstat (limited to 'sql-common')
-rw-r--r-- | sql-common/client.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sql-common/client.c b/sql-common/client.c index 3ee6c600387..6ac26480ff6 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1919,6 +1919,13 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, db ? db : "(Null)", user ? user : "(Null)")); + /* Test whether we're already connected */ + if (net->vio) + { + set_mysql_error(mysql, CR_ALREADY_CONNECTED, unknown_sqlstate); + DBUG_RETURN(0); + } + /* Don't give sigpipe errors if the client doesn't want them */ set_sigpipe(mysql); mysql->methods= &client_methods; |