1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-29 00:08:14 +03:00

manual merge from mysql-5.1-security

This commit is contained in:
Jon Olav Hauglid
2010-07-07 14:18:20 +02:00
3 changed files with 37 additions and 5 deletions

View File

@@ -7331,12 +7331,22 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (table->s->tmp_table != NO_TMP_TABLE)
{
/* Close lock if this is a transactional table */
if (thd->lock &&
! (thd->locked_tables_mode == LTM_LOCK_TABLES ||
thd->locked_tables_mode == LTM_PRELOCKED_UNDER_LOCK_TABLES))
if (thd->lock)
{
mysql_unlock_tables(thd, thd->lock);
thd->lock=0;
if (thd->locked_tables_mode != LTM_LOCK_TABLES &&
thd->locked_tables_mode != LTM_PRELOCKED_UNDER_LOCK_TABLES)
{
mysql_unlock_tables(thd, thd->lock);
thd->lock=0;
}
else
{
/*
If LOCK TABLES list is not empty and contains this table,
unlock the table and remove the table from this list.
*/
mysql_lock_remove(thd, thd->lock, table);
}
}
/* Remove link to old table and rename the new one */
close_temporary_table(thd, table, 1, 1);