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.
This commit is contained in:
Magne Mahre 2009-10-09 14:30:54 +02:00
commit c9248c6424
5 changed files with 65 additions and 13 deletions

View file

@ -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;