This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cluster: master - cman: allow getnameinfo() to fail.


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=4ec60b52bca8f5d44ad35b8ad3754fc6e2463d3c
Commit:        4ec60b52bca8f5d44ad35b8ad3754fc6e2463d3c
Parent:        7f61677ad6cf43bca6ec13ed41aa765cac280205
Author:        Christine Caulfield <ccaulfie@redhat.com>
AuthorDate:    Thu Jan 29 12:04:46 2009 +0000
Committer:     Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Thu Jan 29 12:04:46 2009 +0000

cman: allow getnameinfo() to fail.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
 cman/services/cman/lib/libcman.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/cman/services/cman/lib/libcman.c b/cman/services/cman/lib/libcman.c
index beb1091..22c51f8 100644
--- a/cman/services/cman/lib/libcman.c
+++ b/cman/services/cman/lib/libcman.c
@@ -1015,6 +1015,7 @@ int cman_get_nodes(cman_handle_t handle, int maxnodes, int *retnodes, cman_node_
 		int max_addrs = 4;
 		corosync_cfg_node_address_t addrs[max_addrs];
 		int num_addrs;
+		char *name = NULL;
 		int error;
 
 		if (!cman_inst->cfg_handle) {
@@ -1029,11 +1030,13 @@ int cman_get_nodes(cman_handle_t handle, int maxnodes, int *retnodes, cman_node_
 			nodes[i].cn_member = 1;
 
 			error = corosync_cfg_get_node_addrs(cman_inst->cfg_handle, nodes[i].cn_nodeid, max_addrs, &num_addrs, addrs);
-			if (error) {
-				sprintf(nodes[i].cn_name, "Node-%x", nodes[i].cn_nodeid);
+			if (!error)
+				name = node_name(&addrs[0]);
+			if (name) {
+				sprintf(nodes[i].cn_name, "%s", name);
 			}
 			else {
-				sprintf(nodes[i].cn_name, "%s", node_name(&addrs[0]));
+				sprintf(nodes[i].cn_name, "Node-%x", nodes[i].cn_nodeid);
 			}
 		}
 	}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]