From mboxrd@z Thu Jan 1 00:00:00 1970 From: pcaulfield@sourceware.org Date: 11 Jul 2006 08:13:19 -0000 Subject: [Cluster-devel] cluster/cman/lib libcman.c libcman.h Message-ID: <20060711081319.26879.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Changes by: pcaulfield at sourceware.org 2006-07-11 08:13:18 Modified files: cman/lib : libcman.c libcman.h Log message: Don't copy the agent name if it's NULL. Make the requred size of the agent string clear. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.c.diff?cvsroot=cluster&r1=1.24&r2=1.25 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.h.diff?cvsroot=cluster&r1=1.25&r2=1.26 --- cluster/cman/lib/libcman.c 2006/05/10 14:20:07 1.24 +++ cluster/cman/lib/libcman.c 2006/07/11 08:13:18 1.25 @@ -943,7 +943,8 @@ ret = info_call(h, CMAN_CMD_GET_FENCE_INFO, &nodeid, sizeof(int), &f, sizeof(f)); if (!ret) { *time = f.fence_time; - strcpy(agent, f.fence_agent); + if (agent) + strcpy(agent, f.fence_agent); *fenced = ((f.flags & FENCE_FLAGS_FENCED) != 0); } return ret; --- cluster/cman/lib/libcman.h 2006/06/20 15:27:04 1.25 +++ cluster/cman/lib/libcman.h 2006/07/11 08:13:18 1.26 @@ -30,9 +30,10 @@ /* * Some maxima */ -#define CMAN_MAX_ADDR_LEN sizeof(struct sockaddr_in6) -#define CMAN_MAX_NODENAME_LEN 255 -#define MAX_CLUSTER_NAME_LEN 16 +#define CMAN_MAX_ADDR_LEN sizeof(struct sockaddr_in6) +#define CMAN_MAX_NODENAME_LEN 255 +#define MAX_CLUSTER_NAME_LEN 16 +#define CMAN_MAX_FENCE_AGENT_NAME_LEN 255 /* * Pass this into cman_get_node() as the nodeid to get local node information @@ -286,6 +287,7 @@ /* Get fence information for a node. * 'int *fenced' is only valid if the node is down, it is set to * 1 if the node has been fenced since it left the cluster. + * agent should be CMAN_MAX_FENCE_AGENT_NAME_LEN */ int cman_get_fenceinfo(cman_handle_t handle, int nodeid, uint64_t *fence_time, int *fenced, char *agent);