diff options
author | Kentoku <kentokushiba@gmail.com> | 2019-12-06 04:32:56 +0900 |
---|---|---|
committer | Kentoku SHIBA <kentokushiba@gmail.com> | 2019-12-06 05:10:01 +0900 |
commit | f5b76d8c40f38466c51bb9213bf8efa05c6423bd (patch) | |
tree | d0139a39dc210a29d37ae6339e9ed056778fbb2a /storage | |
parent | aab6cefe8dc132ec6a16e6af5c616765671ac9af (diff) | |
download | mariadb-git-f5b76d8c40f38466c51bb9213bf8efa05c6423bd.tar.gz |
fix compiler warnings
Diffstat (limited to 'storage')
-rw-r--r-- | storage/spider/spd_conn.cc | 6 | ||||
-rw-r--r-- | storage/spider/spd_db_mysql.cc | 4 | ||||
-rw-r--r-- | storage/spider/spd_include.h | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index cf1c5733e71..5e5fa0eda52 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -4565,16 +4565,18 @@ SPIDER_IP_PORT_CONN* spider_create_ipport_conn(SPIDER_CONN *conn) goto err_malloc_key; } - ret->key = (char *) my_malloc(ret->key_len, MY_ZEROFILL | MY_WME); + ret->key = (char *) my_malloc(ret->key_len + conn->tgt_host_length + 1, + MY_ZEROFILL | MY_WME); if (!ret->key) { pthread_cond_destroy(&ret->cond); pthread_mutex_destroy(&ret->mutex); goto err_malloc_key; } + ret->remote_ip_str = ret->key + ret->key_len; memcpy(ret->key, conn->conn_key, ret->key_len); - strncpy(ret->remote_ip_str, conn->tgt_host, sizeof(ret->remote_ip_str)); + memcpy(ret->remote_ip_str, conn->tgt_host, conn->tgt_host_length); ret->remote_port = conn->tgt_port; ret->conn_id = conn->conn_id; ret->ip_port_count = 1; // init diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 0a634a60f42..1e8b5c40a03 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -14131,7 +14131,7 @@ int spider_mbase_handler::simple_action( SPIDER_DB_RESULT *res; SPIDER_SHARE *share = spider->share; uint pos = spider->conn_link_idx[link_idx]; - spider_string *str; + spider_string *str = NULL; DBUG_ENTER("spider_mbase_handler::simple_action"); switch (simple_action) { @@ -14172,7 +14172,7 @@ int spider_mbase_handler::simple_action( #endif default: DBUG_ASSERT(0); - break; + DBUG_RETURN(0); } pthread_mutex_lock(&conn->mta_conn_mutex); SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index 30a5d598709..2249d3e699c 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -1452,7 +1452,7 @@ typedef struct st_spider_ip_port_conn { #ifdef SPIDER_HAS_HASH_VALUE_TYPE my_hash_value_type key_hash_value; #endif - char remote_ip_str[SPIDER_CONN_META_BUF_LEN]; + char *remote_ip_str; long remote_port; ulong ip_port_count; volatile ulong waiting_count; |