Commit 44ed4907 authored by unknown's avatar unknown

Bug#25183 (Compiler warnings in the sql directory (GCC 4.1))

Fixed compiler warnings.

In set_var.cc, the code was not properly returning an error code
if close_cached_tables() failed.

In sql_tables.cc, the code was not returning properly an error code
if lock_table_names() failed.

Both cases are bugs, introduced in 5.1 only by recent changes.


sql/set_var.cc:
  Fixed build warnings:
  set_var.cc:3861: warning: 'result' may be used uninitialized in this function
sql/sql_table.cc:
  Fixed build warnings:
  sql_table.cc:5307: warning: 'error' may be used uninitialized in this function
parent 552d4ced
...@@ -3904,7 +3904,7 @@ bool sys_var_opt_readonly::update(THD *thd, set_var *var) ...@@ -3904,7 +3904,7 @@ bool sys_var_opt_readonly::update(THD *thd, set_var *var)
can cause to wait on a read lock, it's required for the client application can cause to wait on a read lock, it's required for the client application
to unlock everything, and acceptable for the server to wait on all locks. to unlock everything, and acceptable for the server to wait on all locks.
*/ */
if (close_cached_tables(thd, true, NULL, false)) if (result= close_cached_tables(thd, true, NULL, false))
goto end_with_read_lock; goto end_with_read_lock;
if (result= make_global_read_lock_block_commit(thd)) if (result= make_global_read_lock_block_commit(thd))
......
...@@ -5406,16 +5406,19 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -5406,16 +5406,19 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
{ {
my_message(ER_LOCK_OR_ACTIVE_TRANSACTION, my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0)); ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
if (wait_if_global_read_lock(thd,0,1)) if (wait_if_global_read_lock(thd,0,1))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
VOID(pthread_mutex_lock(&LOCK_open)); VOID(pthread_mutex_lock(&LOCK_open));
if (lock_table_names(thd, table_list)) if (lock_table_names(thd, table_list))
{
error= TRUE;
goto view_err; goto view_err;
}
error=0; error= FALSE;
if (!do_rename(thd, table_list, new_db, new_name, new_name, 1)) if (!do_rename(thd, table_list, new_db, new_name, new_name, 1))
{ {
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
...@@ -5556,6 +5559,10 @@ view_err: ...@@ -5556,6 +5559,10 @@ view_err:
error=table->file->disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE); error=table->file->disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
/* COND_refresh will be signaled in close_thread_tables() */ /* COND_refresh will be signaled in close_thread_tables() */
break; break;
default:
DBUG_ASSERT(FALSE);
error= 0;
break;
} }
if (error == HA_ERR_WRONG_COMMAND) if (error == HA_ERR_WRONG_COMMAND)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment