cluster: STABLE31 - cman preconfig: fix segfault if we cannot determine cluster name

Fabio M. Di Nitto fabbione at fedoraproject.org
Mon Mar 28 14:13:02 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=e6e7f1837b53d8f2095392afc30aca411307730c
Commit:        e6e7f1837b53d8f2095392afc30aca411307730c
Parent:        ab50640bc9093597e237efe6b728f13542b1ec4f
Author:        Fabio M. Di Nitto <fdinitto at redhat.com>
AuthorDate:    Mon Mar 28 16:12:05 2011 +0200
Committer:     Fabio M. Di Nitto <fdinitto at redhat.com>
CommitterDate: Mon Mar 28 16:12:05 2011 +0200

cman preconfig: fix segfault if we cannot determine cluster name

This takes a lot of effort to reproduce, but it can still happen.

Resolves: rhbz#651375

Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>
---
 cman/daemon/cman-preconfig.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index d64da25..a890fb3 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -1275,6 +1275,11 @@ static int get_cman_globals(struct objdb_iface_ver0 *objdb)
 
 	objdb_get_string(objdb, cluster_parent_handle, "name", &cluster_name);
 
+	if (!cluster_name) {
+		sprintf(error_reason, "Unable to determine cluster name.\n");
+		return -1;
+	}
+
 	/* Get the <cman> bits that override <totem> bits */
 	objdb->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
 	if (objdb->object_find_next(find_handle, &object_handle) == 0) {


More information about the cluster-commits mailing list