public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* master - cman: cope better with malformed config files
@ 2008-09-03 12:32 Christine Caulfield
0 siblings, 0 replies; only message in thread
From: Christine Caulfield @ 2008-09-03 12:32 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=3941e5e4ce38ac3ac49d7dcf4e838dd30b063c62
Commit: 3941e5e4ce38ac3ac49d7dcf4e838dd30b063c62
Parent: f308bb5e0a3f7dde8340046a92acee8e72c0017c
Author: Christine Caulfield <ccaulfie@redhat.com>
AuthorDate: Wed Sep 3 11:56:52 2008 +0100
Committer: Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Wed Sep 3 11:56:52 2008 +0100
cman: cope better with malformed config files
A config file with
<clusternodes>
<clusternode/
... valid nodes entries
</clusternodes>
would fool cman into not finding the nodename, even though it exists.
This fixes that.
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
cman/daemon/cman-preconfig.c | 8 ++++++--
cman/daemon/nodelist.h | 3 ++-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index 6715b3f..4926591 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -360,7 +360,8 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *nodename)
if (objdb_get_string(objdb, nodes_handle, "name", &str)) {
sprintf(error_reason, "Cannot get node name");
- break;
+ nodes_handle = nodeslist_next(objdb, find_handle);
+ continue;
}
strcpy(nodename3, str);
@@ -494,7 +495,7 @@ static int get_env_overrides()
static int get_nodename(struct objdb_iface_ver0 *objdb)
{
- char *nodeid_str;
+ char *nodeid_str = NULL;
unsigned int object_handle;
unsigned int find_handle;
unsigned int node_object_handle;
@@ -552,6 +553,9 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
write_cman_pipe("This node has no nodeid in cluster.conf");
return -1;
}
+ sprintf(error_reason, "Failed to find node name in cluster.conf");
+ write_cman_pipe("Failed to find node name in cluster.conf");
+ return -1;
}
objdb->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
diff --git a/cman/daemon/nodelist.h b/cman/daemon/nodelist.h
index faf63c1..02dfe17 100644
--- a/cman/daemon/nodelist.h
+++ b/cman/daemon/nodelist.h
@@ -79,7 +79,8 @@ static inline unsigned int nodelist_byname(OBJDB_API *corosync,
nodes_handle = nodeslist_init(corosync, cluster_parent_handle, &find_handle);
while (nodes_handle) {
if (objdb_get_string(corosync, nodes_handle, "name", &nodename)) {
- break;
+ nodes_handle = nodeslist_next(corosync, find_handle);
+ continue;
}
if (strcmp(nodename, name) == 0)
return nodes_handle;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-09-03 11:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-03 12:32 master - cman: cope better with malformed config files Christine Caulfield
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 read-only IMAP folder(s) and NNTP newsgroup(s).