From mboxrd@z Thu Jan 1 00:00:00 1970 From: fabbione@sourceware.org Date: 24 Oct 2007 03:21:45 -0000 Subject: [Cluster-devel] cluster/cman/daemon cmanccs.c Message-ID: <20071024032145.17429.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --- cluster/cman/daemon/cmanccs.c 2007/10/24 03:21:22 1.33 +++ cluster/cman/daemon/cmanccs.c 2007/10/24 03:21:45 1.34 @@ -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);