many warnings (practically safe but annoying) corrected

This commit is contained in:
serg@serg.mylan 2006-01-03 17:54:54 +01:00
parent 04cff0d055
commit 14f94dc0ca
38 changed files with 274 additions and 231 deletions

View File

@ -569,6 +569,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
return -1;
}
mysql_close(mysql); /* Close connection to avoid error messages */
argc=1; /* force SHUTDOWN to be the last command */
if (got_pidfile)
{
if (opt_verbose)

View File

@ -1266,12 +1266,13 @@ at offset %lu ; this could be a log format error or read error",
}
else if (buf[4] == ROTATE_EVENT)
{
Log_event *ev;
my_b_seek(file, tmp_pos); /* seek back to event's start */
if (!Log_event::read_log_event(file, *description_event))
if (!(ev= Log_event::read_log_event(file, *description_event)))
/* EOF can't be hit here normally, so it's a real error */
die("Could not read a Rotate_log_event event \
at offset %lu ; this could be a log format error or read error",
tmp_pos);
die("Could not read a Rotate_log_event event at offset %lu ;"
" this could be a log format error or read error", tmp_pos);
delete ev;
}
else
break;

View File

@ -1306,7 +1306,7 @@ static uint dump_routines_for_db(char *db)
fprintf(sql_file, "DELIMITER ;\n");
if (lock_tables)
mysql_query_with_error_report(sock, 0, "UNLOCK TABLES");
VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES"));
DBUG_RETURN(0);
}
@ -2095,7 +2095,10 @@ static void dump_table(char *table, char *db)
else
res=mysql_store_result(sock);
if (!res)
{
DB_error(sock, "when retrieving data from server");
goto err;
}
if (verbose)
fprintf(stderr, "-- Retrieving rows...\n");
if (mysql_num_fields(res) != num_fields)
@ -2625,7 +2628,7 @@ static int dump_all_tables_in_db(char *database)
check_io(md_result_file);
}
if (lock_tables)
mysql_query_with_error_report(sock, 0, "UNLOCK TABLES");
VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES"));
return 0;
} /* dump_all_tables_in_db */
@ -2680,7 +2683,7 @@ static my_bool dump_all_views_in_db(char *database)
check_io(md_result_file);
}
if (lock_tables)
mysql_query(sock,"UNLOCK TABLES");
VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES"));
return 0;
} /* dump_all_tables_in_db */
@ -2839,7 +2842,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
check_io(md_result_file);
}
if (lock_tables)
mysql_query_with_error_report(sock, 0, "UNLOCK TABLES");
VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES"));
DBUG_RETURN(0);
} /* dump_selected_tables */

View File

@ -676,8 +676,8 @@ history_load(History *h, const char *fname)
(void) strunvis(ptr, line);
line[sz] = c;
if (HENTER(h, &ev, ptr) == -1) {
h_free((ptr_t)ptr);
return -1;
i = -1;
goto oomem;
}
}
oomem:

View File

@ -404,7 +404,8 @@ enum ha_base_keytype {
enum en_fieldtype {
FIELD_LAST=-1,FIELD_NORMAL,FIELD_SKIP_ENDSPACE,FIELD_SKIP_PRESPACE,
FIELD_SKIP_ZERO,FIELD_BLOB,FIELD_CONSTANT,FIELD_INTERVALL,FIELD_ZERO,
FIELD_VARCHAR,FIELD_CHECK
FIELD_VARCHAR,FIELD_CHECK,
FIELD_enum_val_count
};
enum data_file_type {

View File

@ -818,7 +818,7 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename)
if ((*options->local_infile_init)(&li_ptr, net_filename,
options->local_infile_userdata))
{
my_net_write(net,"",0); /* Server needs one packet */
VOID(my_net_write(net,"",0)); /* Server needs one packet */
net_flush(net);
strmov(net->sqlstate, unknown_sqlstate);
net->last_errno= (*options->local_infile_error)(li_ptr,

View File

@ -276,7 +276,8 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (subkeys == -1)
{
/* the last entry in sub-tree */
_mi_dispose(info, keyinfo, root,DFLT_INIT_HITS);
if (_mi_dispose(info, keyinfo, root,DFLT_INIT_HITS))
DBUG_RETURN(-1);
/* fall through to normal delete */
}
else

View File

@ -1159,7 +1159,7 @@ static int compare_huff_elements(void *not_used __attribute__((unused)),
static void check_counts(HUFF_COUNTS *huff_counts, uint trees,
my_off_t records)
{
uint space_fields,fill_zero_fields,field_count[(int) FIELD_VARCHAR+1];
uint space_fields,fill_zero_fields,field_count[(int) FIELD_enum_val_count];
my_off_t old_length,new_length,length;
DBUG_ENTER("check_counts");

View File

@ -376,7 +376,10 @@ pthread_handler_t thr_find_all_keys(void *arg)
{
if (my_init_dynamic_array(&info->buffpek, sizeof(BUFFPEK),
maxbuffer, maxbuffer/2))
{
my_free((gptr) sort_keys,MYF(0));
sort_keys= (uchar **) NULL; /* for err: label */
}
else
break;
}

View File

@ -197,7 +197,7 @@ int modify_defaults_file(const char *file_location, const char *option,
goto err;
}
if (my_fclose(cnf_file, MYF(MY_WME)))
goto err;
DBUG_RETURN(1);
my_free(file_buffer, MYF(0));
DBUG_RETURN(0);

View File

@ -91,7 +91,7 @@ void my_b_seek(IO_CACHE *info,my_off_t pos)
b) see if there is a better way to make it work
*/
if (info->type == SEQ_READ_APPEND)
flush_io_cache(info);
VOID(flush_io_cache(info));
offset=(pos - info->pos_in_file);
@ -119,7 +119,7 @@ void my_b_seek(IO_CACHE *info,my_off_t pos)
info->write_pos = info->write_buffer + offset;
DBUG_VOID_RETURN;
}
flush_io_cache(info);
VOID(flush_io_cache(info));
/* Correct buffer end so that we write in increments of IO_SIZE */
info->write_end=(info->write_buffer+info->buffer_length-
(pos & (IO_SIZE-1)));

View File

@ -69,7 +69,7 @@ my_bool bitmap_init(MY_BITMAP *map, uchar *buf, uint bitmap_size,
(thread_safe ?
sizeof(pthread_mutex_t) : 0),
MYF(MY_WME | MY_ZEROFILL))))
return 1;
DBUG_RETURN(1);
map->bitmap_size=bitmap_size;
#ifdef THREAD
if (thread_safe)

View File

@ -189,7 +189,10 @@ int my_error_register(const char **errmsgs, int first, int last)
/* Error numbers must be unique. No overlapping is allowed. */
if (*search_meh_pp && ((*search_meh_pp)->meh_first <= last))
{
my_free((gptr)meh_p, MYF(0));
return 1;
}
/* Insert header into the chain. */
meh_p->meh_next= *search_meh_pp;

View File

@ -107,7 +107,7 @@ Token shift_token(const char **text, uint *word_len)
int get_text_id(const char **text, uint *word_len, const char **id)
{
get_word(text, word_len);
if (word_len == 0)
if (*word_len == 0)
return 1;
*id= *text;
return 0;

View File

@ -599,7 +599,7 @@ net_safe_read(MYSQL *mysql)
DBUG_PRINT("error",("Wrong connection or packet. fd: %s len: %d",
vio_description(net->vio),len));
#ifdef MYSQL_SERVER
if (vio_was_interrupted(net->vio))
if (net->vio && vio_was_interrupted(net->vio))
return (packet_error);
#endif /*MYSQL_SERVER*/
end_server(mysql);

View File

@ -1570,7 +1570,6 @@ Field *Field::new_key_field(MEM_ROOT *root, struct st_table *new_table,
bool Field::quote_data(String *unquoted_string)
{
char escaped_string[IO_SIZE];
char *unquoted_string_buffer= (char *)(unquoted_string->ptr());
DBUG_ENTER("Field::quote_data");
if (!needs_quotes())
@ -4541,8 +4540,6 @@ int Field_timestamp::store(const char *from,uint len,CHARSET_INFO *cs)
error= 1;
}
}
if (error > 1)
error= 2;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
@ -7064,7 +7061,7 @@ void Field_blob::get_key_image(char *buff, uint length, imagetype type)
}
get_ptr(&blob);
gobj= Geometry::construct(&buffer, blob, blob_length);
if (gobj->get_mbr(&mbr, &dummy))
if (!gobj || gobj->get_mbr(&mbr, &dummy))
bzero(buff, SIZEOF_STORED_DOUBLE*4);
else
{
@ -7393,7 +7390,7 @@ void Field_geom::get_key_image(char *buff, uint length, imagetype type)
}
get_ptr(&blob);
gobj= Geometry::construct(&buffer, blob, blob_length);
if (gobj->get_mbr(&mbr, &dummy))
if (!gobj || gobj->get_mbr(&mbr, &dummy))
bzero(buff, SIZEOF_STORED_DOUBLE*4);
else
{
@ -8152,16 +8149,13 @@ const char *Field_bit::unpack(char *to, const char *from)
Field_bit_as_char::Field_bit_as_char(char *ptr_arg, uint32 len_arg,
uchar *null_ptr_arg, uchar null_bit_arg,
uchar *bit_ptr_arg, uchar bit_ofs_arg,
enum utype unireg_check_arg,
const char *field_name_arg,
struct st_table *table_arg)
: Field_bit(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, bit_ptr_arg,
bit_ofs_arg, unireg_check_arg, field_name_arg, table_arg),
: Field_bit(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, 0,
0, unireg_check_arg, field_name_arg, table_arg),
create_length(len_arg)
{
bit_ptr= 0;
bit_ofs= 0;
bit_len= 0;
field_length= ((len_arg + 7) & ~7) / 8;
}
@ -8518,8 +8512,8 @@ Field *make_field(char *ptr, uint32 field_length,
return new Field_null(ptr,field_length,unireg_check,field_name,table, field_charset);
case FIELD_TYPE_BIT:
return f_bit_as_char(pack_flag) ?
new Field_bit_as_char(ptr, field_length, null_pos, null_bit, bit_ptr,
bit_offset, unireg_check, field_name, table) :
new Field_bit_as_char(ptr, field_length, null_pos, null_bit,
unireg_check, field_name, table) :
new Field_bit(ptr, field_length, null_pos, null_bit, bit_ptr,
bit_offset, unireg_check, field_name, table);
default: // Impossible (Wrong version)

View File

@ -1341,7 +1341,7 @@ class Field_bit_as_char: public Field_bit {
public:
uchar create_length;
Field_bit_as_char(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
struct st_table *table_arg);
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }

View File

@ -266,7 +266,8 @@ int ha_myisam::dump(THD* thd, int fd)
if (fd < 0)
{
my_net_write(net, "", 0);
if (my_net_write(net, "", 0))
error = errno ? errno : EPIPE;
net_flush(net);
}
@ -365,11 +366,13 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
{
uint old_testflag=param.testflag;
param.testflag|=T_MEDIUM;
init_io_cache(&param.read_cache, file->dfile,
if (!(error= init_io_cache(&param.read_cache, file->dfile,
my_default_record_cache_size, READ_CACHE,
share->pack.header_length, 1, MYF(MY_WME));
error |= chk_data_link(&param, file, param.testflag & T_EXTEND);
share->pack.header_length, 1, MYF(MY_WME))))
{
error= chk_data_link(&param, file, param.testflag & T_EXTEND);
end_io_cache(&(param.read_cache));
}
param.testflag= old_testflag;
}
}

View File

@ -931,9 +931,9 @@ void Item_splocal::cleanup()
void Item_splocal::print(String *str)
{
str->reserve(m_name.length+8);
str->append(m_name.str, m_name.length);
str->append('@');
VOID(str->reserve(m_name.length+8));
VOID(str->append(m_name.str, m_name.length));
VOID(str->append('@'));
str->qs_append(m_offset);
}
@ -3784,7 +3784,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table)
return new Field_year((char*) 0, max_length, null_ptr, 0, Field::NONE,
name, table);
case MYSQL_TYPE_BIT:
return new Field_bit_as_char(NULL, max_length, null_ptr, 0, NULL, 0,
return new Field_bit_as_char(NULL, max_length, null_ptr, 0,
Field::NONE, name, table);
default:
/* This case should never be chosen */

View File

@ -888,7 +888,7 @@ String *Item_decimal_typecast::val_str(String *str)
my_decimal tmp_buf, *tmp= val_decimal(&tmp_buf);
if (null_value)
return NULL;
my_decimal2string(E_DEC_FATAL_ERROR, &tmp_buf, 0, 0, 0, str);
my_decimal2string(E_DEC_FATAL_ERROR, tmp, 0, 0, 0, str);
return str;
}
@ -4742,7 +4742,12 @@ Item_func_sp::execute(Field **flp)
}
if (!(f= *flp))
{
*flp= f= sp_result_field();
if (!(*flp= f= sp_result_field()))
{
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
return 0;
}
f->move_field((f->pack_length() > sizeof(result_buf)) ?
sql_alloc(f->pack_length()) : result_buf);
f->null_ptr= (uchar *)&null_value;

View File

@ -3253,6 +3253,10 @@ void Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
case INSERT_ID_EVENT:
msg="INSERT_ID";
break;
case INVALID_INT_EVENT:
default: // cannot happen
msg="INVALID_INT";
break;
}
fprintf(file, "%s=%s;\n", msg, llstr(val,llbuff));
fflush(file);

View File

@ -652,7 +652,6 @@ SQL_SELECT *make_select(TABLE *head, table_map const_tables,
table_map read_tables, COND *conds,
bool allow_null_cond,
int *error)
{
SQL_SELECT *select;
DBUG_ENTER("make_select");
@ -5774,10 +5773,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
if (!quick)
return 0; /* no ranges found */
if (quick->init())
{
delete quick;
goto err;
}
quick->records= records;
if (cp_buffer_from_ref(thd,ref) && thd->is_fatal_error ||
@ -7111,7 +7107,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
ha_rows cur_records;
SEL_ARG *cur_index_tree= NULL;
ha_rows cur_quick_prefix_records= 0;
uint cur_param_idx;
uint cur_param_idx=MAX_KEY;
key_map cur_used_key_parts;
uint pk= param->table->s->primary_key;
@ -7327,6 +7323,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
*/
if (cur_read_cost < best_read_cost - (DBL_EPSILON * cur_read_cost))
{
DBUG_ASSERT(tree != 0 || cur_param_idx == MAX_KEY);
index_info= cur_index_info;
index= cur_index;
best_read_cost= cur_read_cost;

View File

@ -705,7 +705,7 @@ class SQL_SELECT :public Sql_alloc {
class FT_SELECT: public QUICK_RANGE_SELECT {
public:
FT_SELECT(THD *thd, TABLE *table, uint key) :
QUICK_RANGE_SELECT (thd, table, key, 1) { init(); }
QUICK_RANGE_SELECT (thd, table, key, 1) { VOID(init()); }
~FT_SELECT() { file->ft_end(); }
int init() { return error=file->ft_init(); }
int reset() { return 0; }

View File

@ -929,7 +929,8 @@ bool load_master_data(THD* thd)
host was specified; there could have been a problem when replication
started, which led to relay log's IO_CACHE to not be inited.
*/
flush_master_info(active_mi, 0);
if (flush_master_info(active_mi, 0))
sql_print_error("Failed to flush master info file");
}
mysql_free_result(master_status_res);
}

View File

@ -2518,7 +2518,6 @@ bool sys_var_slave_skip_counter::update(THD *thd, set_var *var)
bool sys_var_sync_binlog_period::update(THD *thd, set_var *var)
{
pthread_mutex_t *lock_log= mysql_bin_log.get_log_lock();
sync_binlog_period= (ulong) var->save_result.ulonglong_value;
return 0;
}

View File

@ -2017,7 +2017,8 @@ static void write_ignored_events_info_to_relay_log(THD *thd, MASTER_INFO *mi)
" to the relay log, "
"SHOW SLAVE STATUS may be inaccurate");
rli->relay_log.harvest_bytes_written(&rli->log_space_total);
flush_master_info(mi, 1);
if (flush_master_info(mi, 1))
sql_print_error("Failed to flush master info file");
delete ev;
}
else
@ -2563,8 +2564,13 @@ bool show_master_info(THD* thd, MASTER_INFO* mi)
DBUG_RETURN(FALSE);
}
bool flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache)
/*
RETURN
2 - flush relay log failed
1 - flush master info failed
0 - all ok
*/
int flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache)
{
IO_CACHE* file = &mi->file;
char lbuf[22];
@ -2583,8 +2589,9 @@ bool flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache)
When we come to this place in code, relay log may or not be initialized;
the caller is responsible for setting 'flush_relay_log_cache' accordingly.
*/
if (flush_relay_log_cache)
flush_io_cache(mi->rli.relay_log.get_log_file());
if (flush_relay_log_cache &&
flush_io_cache(mi->rli.relay_log.get_log_file()))
DBUG_RETURN(2);
/*
We flushed the relay log BEFORE the master.info file, because if we crash
@ -2611,8 +2618,7 @@ bool flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache)
mi->password, mi->port, mi->connect_retry,
(int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert,
mi->ssl_cipher, mi->ssl_key);
flush_io_cache(file);
DBUG_RETURN(0);
DBUG_RETURN(-flush_io_cache(file));
}
@ -3644,7 +3650,11 @@ reconnect done to recover from failed read");
sql_print_error("Slave I/O thread could not queue event from master");
goto err;
}
flush_master_info(mi, 1); /* sure that we can flush the relay log */
if (flush_master_info(mi, 1))
{
sql_print_error("Failed to flush master info file");
goto err;
}
/*
See if the relay logs take too much space.
We don't lock mi->rli.log_space_lock here; this dirty read saves time

View File

@ -500,7 +500,7 @@ typedef struct st_table_rule_ent
int init_slave();
void init_slave_skip_errors(const char* arg);
bool flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache);
int flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache);
bool flush_relay_log_info(RELAY_LOG_INFO* rli);
int register_slave_on_master(MYSQL* mysql);
int terminate_slave_threads(MASTER_INFO* mi, int thread_mask,

View File

@ -937,7 +937,7 @@ bool acl_getroot_no_password(Security_context *sctx, char *user, char *host,
DBUG_PRINT("enter", ("Host: '%s', Ip: '%s', User: '%s', db: '%s'",
(host ? host : "(NULL)"), (ip ? ip : "(NULL)"),
(user ? user : "(NULL)"), (db ? db : "(NULL)")));
user, (db ? db : "(NULL)")));
sctx->user= user;
sctx->host= host;
sctx->ip= ip;
@ -966,7 +966,7 @@ bool acl_getroot_no_password(Security_context *sctx, char *user, char *host,
for (i=0 ; i < acl_users.elements ; i++)
{
acl_user= dynamic_element(&acl_users,i,ACL_USER*);
if ((!acl_user->user && (!user || !user[0])) ||
if ((!acl_user->user && !user[0]) ||
(acl_user->user && strcmp(user, acl_user->user) == 0))
{
if (compare_hostname(&acl_user->host, host, ip))
@ -4939,8 +4939,6 @@ static int handle_grant_struct(uint struct_no, bool drop,
}
if (! user)
user= "";
if (! host)
host= "";
#ifdef EXTRA_DEBUG
DBUG_PRINT("loop",("scan struct: %u index: %u user: '%s' host: '%s'",
struct_no, idx, user, host));

View File

@ -319,10 +319,12 @@ bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
DBUG_RETURN(0);
/* Otherwise, load options from the .opt file */
if ((file=my_open(path, O_RDONLY | O_SHARE, MYF(0))) >= 0)
{
if ((file=my_open(path, O_RDONLY | O_SHARE, MYF(0))) < 0)
goto err1;
IO_CACHE cache;
init_io_cache(&cache, file, IO_SIZE, READ_CACHE, 0, 0, MYF(0));
if (init_io_cache(&cache, file, IO_SIZE, READ_CACHE, 0, 0, MYF(0)))
goto err2;
while ((int) (nbytes= my_b_gets(&cache, (char*) buf, sizeof(buf))) > 0)
{
@ -364,8 +366,6 @@ bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
}
}
}
end_io_cache(&cache);
my_close(file,MYF(0));
/*
Put the loaded value into the hash.
Note that another thread could've added the same
@ -374,7 +374,11 @@ bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
possibility into account.
*/
error= put_dbopt(path, create);
}
end_io_cache(&cache);
err2:
my_close(file,MYF(0));
err1:
DBUG_RETURN(error);
}

View File

@ -377,10 +377,8 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
address of the 'next' pointer referencing this table
for close_thread_table().
*/
for (table_ptr= &(thd->handler_tables);
*table_ptr && (*table_ptr != table);
table_ptr= &(*table_ptr)->next)
{}
for (table_ptr= &(thd->handler_tables); *table_ptr != table;
table_ptr= &(*table_ptr)->next) /* no-op */ ;
(*table_ptr)->file->ha_index_or_rnd_end();
VOID(pthread_mutex_lock(&LOCK_open));
if (close_thread_table(thd, table_ptr))

View File

@ -567,7 +567,7 @@ SQL_SELECT *prepare_simple_select(THD *thd, Item *cond,
SQL_SELECT *res= make_select(table, 0, 0, cond, 0, error);
if (*error || (res && res->check_quick(thd, 0, HA_POS_ERROR)) ||
(res->quick && res->quick->reset()))
(res && res->quick && res->quick->reset()))
{
delete res;
res=0;

View File

@ -666,7 +666,8 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view)
DBUG_ASSERT(view->table != 0 && view->field_translation != 0);
bitmap_init(&used_fields, used_fields_buff, used_fields_buff_size * 8, 0);
VOID(bitmap_init(&used_fields, used_fields_buff, used_fields_buff_size * 8,
0));
bitmap_clear_all(&used_fields);
view->contain_auto_increment= 0;

View File

@ -1593,6 +1593,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
statistic_increment(thd->status_var.com_other, &LOCK_status);
thd->enable_slow_log= opt_log_slow_admin_statements;
db= thd->alloc(db_len + tbl_len + 2);
if (!db)
{
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
break;
}
tbl_name= strmake(db, packet + 1, db_len)+1;
strmake(tbl_name, packet + db_len + 2, tbl_len);
mysql_table_dump(thd, db, tbl_name, -1);
@ -6865,6 +6870,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
#ifdef HAVE_REPLICATION
if (options & REFRESH_MASTER)
{
DBUG_ASSERT(thd);
tmp_write_to_binlog= 0;
if (reset_master(thd))
{

View File

@ -1197,7 +1197,12 @@ bool change_master(THD* thd, MASTER_INFO* mi)
Relay log's IO_CACHE may not be inited, if rli->inited==0 (server was never
a slave before).
*/
flush_master_info(mi, 0);
if (flush_master_info(mi, 0))
{
my_error(ER_RELAY_LOG_INIT, MYF(0), "Failed to flush master info file");
unlock_slave_threads(mi);
DBUG_RETURN(TRUE);
}
if (need_relay_log_purge)
{
relay_log_purge= 1;
@ -1307,14 +1312,15 @@ bool mysql_show_binlog_events(THD* thd)
bool ret = TRUE;
IO_CACHE log;
File file = -1;
Format_description_log_event *description_event= new
Format_description_log_event(3); /* MySQL 4.0 by default */
Log_event::init_show_field_list(&field_list);
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
Format_description_log_event *description_event= new
Format_description_log_event(3); /* MySQL 4.0 by default */
if (mysql_bin_log.is_open())
{
LEX_MASTER_INFO *lex_mi= &thd->lex->mi;

View File

@ -663,7 +663,7 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
it's a keyword
*/
packet->reserve(length*2 + 2);
VOID(packet->reserve(length*2 + 2));
quote_char= (char) q;
packet->append(&quote_char, 1, system_charset_info);
@ -950,7 +950,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
if (key_part->field)
append_identifier(thd,packet,key_part->field->field_name,
strlen(key_part->field->field_name));
if (!key_part->field ||
if (key_part->field &&
(key_part->length !=
table->field[key_part->fieldnr-1]->key_length() &&
!(key_info->flags & HA_FULLTEXT)))
@ -1732,7 +1732,8 @@ LEX_STRING *make_lex_string(THD *thd, LEX_STRING *lex_str,
{
MEM_ROOT *mem= thd->mem_root;
if (allocate_lex_string)
lex_str= (LEX_STRING *)thd->alloc(sizeof(LEX_STRING));
if (!(lex_str= (LEX_STRING *)thd->alloc(sizeof(LEX_STRING))))
return 0;
lex_str->str= strmake_root(mem, str, length);
lex_str->length= length;
return lex_str;
@ -2982,7 +2983,7 @@ static int get_schema_stat_record(THD *thd, struct st_table_list *tables,
table->field[9]->set_notnull();
}
if (!(key_info->flags & HA_FULLTEXT) &&
(!key_part->field ||
(key_part->field &&
key_part->length !=
show_table->field[key_part->fieldnr-1]->key_length()))
{

View File

@ -450,7 +450,7 @@ void mysql_print_status()
calc_sum_of_all_status(&tmp);
printf("\nStatus information:\n\n");
my_getwd(current_dir, sizeof(current_dir),MYF(0));
VOID(my_getwd(current_dir, sizeof(current_dir),MYF(0)));
printf("Current dir: %s\n", current_dir);
printf("Running threads: %d Stack size: %ld\n", thread_count,
(long) thread_stack);

View File

@ -1040,7 +1040,10 @@ ulong get_form_pos(File file, uchar *head, TYPELIB *save_names)
ret_value=uint4korr(pos);
}
if (! save_names)
{
if (names)
my_free((gptr) buf,MYF(0));
}
else if (!names)
bzero((char*) save_names,sizeof(save_names));
else

View File

@ -67,8 +67,8 @@ Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg,
If you change the following, change it in get_max_elements function, too.
*/
max_elements= max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+size);
open_cached_file(&file, mysql_tmpdir,TEMP_PREFIX, DISK_BUFFER_SIZE,
MYF(MY_WME));
VOID(open_cached_file(&file, mysql_tmpdir,TEMP_PREFIX, DISK_BUFFER_SIZE,
MYF(MY_WME)));
}