Spotted by Coverity Scan Signed-off-by: Fabio M. Di Nitto <fdini...@redhat.com> --- :100644 100644 1489f7c... 7641294... M cman/daemon/commands.c :100644 100644 bbf2628... 4851387... M cman/daemon/nodelist.h cman/daemon/commands.c | 18 ------------------ cman/daemon/nodelist.h | 4 +--- 2 files changed, 1 insertions(+), 21 deletions(-)
diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c index 1489f7c..7641294 100644 --- a/cman/daemon/commands.c +++ b/cman/daemon/commands.c @@ -90,7 +90,6 @@ static int ccsd_timer_active = 0; static struct cluster_node *find_node_by_nodeid(int nodeid); static struct cluster_node *find_node_by_name(char *name); static int get_node_count(void); -static int get_highest_nodeid(void); static int send_port_open_msg(unsigned char port); static int send_port_enquire(int nodeid); static void process_internal_message(char *data, int nodeid, int byteswap); @@ -612,13 +611,10 @@ static int do_cmd_get_all_members(char *cmdbuf, char **retbuf, int retsize, int char *outbuf = *retbuf + offset; int num_nodes = 0; int total_nodes = 0; - int highest_node; if (!we_are_a_cluster_member) return -ENOENT; - highest_node = get_highest_nodeid(); - /* Count nodes */ list_iterate(nodelist, &cluster_members_list) { total_nodes++; @@ -1896,7 +1892,6 @@ void send_transition_msg(int last_memb_count, int first_trans) static void byteswap_internal_message(char *data) { struct cl_protmsg *msg = (struct cl_protmsg *)data; - struct cl_barriermsg *barriermsg; struct cl_killmsg *killmsg; struct cl_leavemsg *leavemsg; struct cl_transmsg *transmsg; @@ -1934,7 +1929,6 @@ static void byteswap_internal_message(char *data) break; case CLUSTER_MSG_BARRIER: - barriermsg = (struct cl_barriermsg *)data; break; case CLUSTER_MSG_RECONFIGURE: @@ -2388,18 +2382,6 @@ void del_ais_node(int nodeid) } } -static int get_highest_nodeid() -{ - int highest = 0; - struct cluster_node *node; - - list_iterate_items(node, &cluster_members_list) { - if (node->node_id > highest) - highest = node->node_id; - } - return highest; -} - static int get_node_count() { int count = 0; diff --git a/cman/daemon/nodelist.h b/cman/daemon/nodelist.h index bbf2628..4851387 100644 --- a/cman/daemon/nodelist.h +++ b/cman/daemon/nodelist.h @@ -2,10 +2,8 @@ static inline int objdb_get_string(OBJDB_API *corosync, hdb_handle_t object_service_handle, const char *key, char **value) { - int res; - *value = NULL; - if ( !(res = corosync->object_key_get(object_service_handle, + if ( !(corosync->object_key_get(object_service_handle, key, strlen(key), (void *)value, -- 1.7.4.4