Skip to contentSkip to conversation

cluster/cman/daemon cmanccs.c

Cluster-devel [email protected] 1 participant 1 message Oct 24, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Changes by: fabbione at sourceware.org 2007-10-24 03:21:45

Modified files:
cman/daemon : cmanccs.c

Log message:
Use standard path var and memset it before each query

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/cmanccs.c.diff?cvsroot=cluster&r1=1.33&r2=1.34

cman/daemon/cmanccs.c +10 -8
@@ -130,24 +130,26 @@
 	two_node = 0;
 
     for (i=1;;i++) {
-	char nodekey[256];
-	char key[256];
+	char path[MAX_PATH_LEN];
 	int  votes=0, nodeid=0;
 
-	sprintf(nodekey, NODE_NAME_PATH_BYNUM, i);
-	error = ccs_get(ctree, nodekey, &nodename);
+	memset(path, 0, MAX_PATH_LEN);
+	sprintf(path, NODE_NAME_PATH_BYNUM, i);
+	error = ccs_get(ctree, path, &nodename);
 	if (error)
 	    break;
 
-	sprintf(key, NODE_VOTES_PATH, nodename);
-	if (!ccs_get(ctree, key, &str)) {
+	memset(path, 0, MAX_PATH_LEN);
+	sprintf(path, NODE_VOTES_PATH, nodename);
+	if (!ccs_get(ctree, path, &str)) {
 	    votes = atoi(str);
 	    free(str);
 	} else
 	    votes = 1;
 
-	sprintf(key, NODE_NODEID_PATH, nodename);
-	if (!ccs_get(ctree, key, &str))	{
+	memset(path, 0, MAX_PATH_LEN);
+	sprintf(path, NODE_NODEID_PATH, nodename);
+	if (!ccs_get(ctree, path, &str)) {
 	    nodeid = atoi(str);
 	    free(str);