diff options
author | unknown <guilhem@gbichot2> | 2004-01-12 21:05:41 +0100 |
---|---|---|
committer | unknown <guilhem@gbichot2> | 2004-01-12 21:05:41 +0100 |
commit | e90eb6f43ed987a9f69b8215bb123396ec9394aa (patch) | |
tree | cba3ce04acb3581cfe1242794740f947880011d8 /sql/sql_db.cc | |
parent | 24f8054460a574660730024690786b877afccfd3 (diff) | |
download | mariadb-git-e90eb6f43ed987a9f69b8215bb123396ec9394aa.tar.gz |
Fix for BUG#2333 "ALTER DATABASE on inexistent database hangs the client":
mysql_alter_db() now returns -1 in case of error, so that mysql_execute_command()
calls send_error().
sql/sql_db.cc:
In case of error, return -1 so that mysql_execute_command()
understands that it must send_error().
The double (( at the left of 'error' in the 'if' are to avoid a compiler warning.
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r-- | sql/sql_db.cc | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 70b1d1d0d3a..08f9ace529d 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -270,11 +270,8 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info) VOID(pthread_mutex_lock(&LOCK_mysql_create_db)); // do not alter database if another thread is holding read lock - if (wait_if_global_read_lock(thd,0)) - { - error= -1; + if ((error=wait_if_global_read_lock(thd,0))) goto exit2; - } /* Check directory */ (void)sprintf(path,"%s/%s/%s", mysql_data_home, db, MY_DB_OPT_FILE); @@ -307,7 +304,7 @@ exit: start_waiting_global_read_lock(thd); exit2: VOID(pthread_mutex_unlock(&LOCK_mysql_create_db)); - DBUG_RETURN(error); + DBUG_RETURN(error ? -1 : 0); /* -1 to delegate send_error() */ } |