diff options
author | Kentoku <kentokushiba@gmail.com> | 2019-12-06 04:32:56 +0900 |
---|---|---|
committer | Kentoku SHIBA <kentokushiba@gmail.com> | 2019-12-06 04:56:57 +0900 |
commit | 37135745db1ae16095ea6590e615806709844707 (patch) | |
tree | e4b497dc5ff93d5c87d4d2d0ba2be105864eba81 | |
parent | 332732da85c65eb7260754ff5d04064b3f9ccad9 (diff) | |
download | mariadb-git-bb-10.4-spider-ks.tar.gz |
fix compiler warningsbb-10.4-spider-ks
-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 9a180e5200e..cc65568b746 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -5113,16 +5113,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 7e06e80f18a..4b6bfcf4f47 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -14534,7 +14534,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) { @@ -14575,7 +14575,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 1aa7626bb5e..754d64fb27d 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -1589,7 +1589,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; |