From: Fabio M. Di Nitto <fabbione@ubuntu.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 3/3] Use standard path var and memset it before each query
Date: Tue, 23 Oct 2007 06:49:35 +0200 [thread overview]
Message-ID: <1193114976326-git-send-email-> (raw)
In-Reply-To: <11931149752477-git-send-email->
From: Fabio M. Di Nitto <fabbione@ubuntu.com>
Signed-off-by: Fabio M. Di Nitto <fabbione@ubuntu.com>
---
:100644 100644 6abc618... 30bf039... M cman/daemon/cmanccs.c
cman/daemon/cmanccs.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/cman/daemon/cmanccs.c b/cman/daemon/cmanccs.c
index 6abc618..30bf039 100644
--- a/cman/daemon/cmanccs.c
+++ b/cman/daemon/cmanccs.c
@@ -130,24 +130,26 @@ int read_ccs_nodes(unsigned int *config_version, int check_nodeids)
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);
--
1.5.2.5
prev parent reply other threads:[~2007-10-23 4:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-23 4:49 [Cluster-devel] Small cman cleanup patches Fabio M. Di Nitto
2007-10-23 4:49 ` [Cluster-devel] [PATCH 1/3] Clean up duplicate ccs query paths Fabio M. Di Nitto
2007-10-23 4:49 ` [Cluster-devel] [PATCH 2/3] Use right vars to print debugging info Fabio M. Di Nitto
2007-10-23 4:49 ` Fabio M. Di Nitto [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1193114976326-git-send-email- \
--to=fabbione@ubuntu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).