Skip to content

Commit f5b76d8

Browse files
committed
fix compiler warnings
1 parent aab6cef commit f5b76d8

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

storage/spider/spd_conn.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4565,16 +4565,18 @@ SPIDER_IP_PORT_CONN* spider_create_ipport_conn(SPIDER_CONN *conn)
45654565
goto err_malloc_key;
45664566
}
45674567

4568-
ret->key = (char *) my_malloc(ret->key_len, MY_ZEROFILL | MY_WME);
4568+
ret->key = (char *) my_malloc(ret->key_len + conn->tgt_host_length + 1,
4569+
MY_ZEROFILL | MY_WME);
45694570
if (!ret->key) {
45704571
pthread_cond_destroy(&ret->cond);
45714572
pthread_mutex_destroy(&ret->mutex);
45724573
goto err_malloc_key;
45734574
}
4575+
ret->remote_ip_str = ret->key + ret->key_len;
45744576

45754577
memcpy(ret->key, conn->conn_key, ret->key_len);
45764578

4577-
strncpy(ret->remote_ip_str, conn->tgt_host, sizeof(ret->remote_ip_str));
4579+
memcpy(ret->remote_ip_str, conn->tgt_host, conn->tgt_host_length);
45784580
ret->remote_port = conn->tgt_port;
45794581
ret->conn_id = conn->conn_id;
45804582
ret->ip_port_count = 1; // init

storage/spider/spd_db_mysql.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14131,7 +14131,7 @@ int spider_mbase_handler::simple_action(
1413114131
SPIDER_DB_RESULT *res;
1413214132
SPIDER_SHARE *share = spider->share;
1413314133
uint pos = spider->conn_link_idx[link_idx];
14134-
spider_string *str;
14134+
spider_string *str = NULL;
1413514135
DBUG_ENTER("spider_mbase_handler::simple_action");
1413614136
switch (simple_action)
1413714137
{
@@ -14172,7 +14172,7 @@ int spider_mbase_handler::simple_action(
1417214172
#endif
1417314173
default:
1417414174
DBUG_ASSERT(0);
14175-
break;
14175+
DBUG_RETURN(0);
1417614176
}
1417714177
pthread_mutex_lock(&conn->mta_conn_mutex);
1417814178
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);

storage/spider/spd_include.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ typedef struct st_spider_ip_port_conn {
14521452
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
14531453
my_hash_value_type key_hash_value;
14541454
#endif
1455-
char remote_ip_str[SPIDER_CONN_META_BUF_LEN];
1455+
char *remote_ip_str;
14561456
long remote_port;
14571457
ulong ip_port_count;
14581458
volatile ulong waiting_count;

0 commit comments

Comments
 (0)