[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH] compare cluster name in cman daemon



if length of cluster name = 16, last char of msg->clustername will not be zero. In this case strcmp will continue read member fence_agent from cl_transmsg structure.


diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c
index 6c91d7a..51478e8 100644
--- a/cman/daemon/commands.c
+++ b/cman/daemon/commands.c
@@ -1504,7 +1504,7 @@ int our_nodeid()
 /* Sanity check TRANSITION message */
 static int valid_transition_msg(int nodeid, struct cl_transmsg *msg)
 {
-	if (strcmp(msg->clustername, cluster_name) != 0) {
+	if (strncmp(msg->clustername, cluster_name, sizeof(msg->clustername)) != 0) {
 		log_msg(LOG_ERR, "Node %d conflict, remote cluster name='%s', local='%s'\n",
 			nodeid, msg->clustername, cluster_name);
 		return -1;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]