[Cluster-devel] cluster/cman/daemon cmanccs.c
fabbione at sourceware.org
fabbione at sourceware.org
Wed Oct 24 03:21:45 UTC 2007
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);
More information about the Cluster-devel
mailing list