Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 58cebef081c94cb5f88b9fe2fbddfdc8 > files > 49

openais-0.80.6-28.el5_6.1.src.rpm

Index: exec/cpg.c
===================================================================
--- exec/cpg.c	(revision 2159)
+++ exec/cpg.c	(revision 2160)
@@ -954,7 +954,21 @@
 	struct cpg_pd *cpd = (struct cpg_pd *)openais_conn_private_data_get (conn);
 	struct res_lib_cpg_join res_lib_cpg_join;
 	SaAisErrorT error = CPG_OK;
+	struct list_head *iter;
 
+	/* Test, if we don't have same pid and group name joined */
+	for (iter = cpg_pd_list_head.next; iter != &cpg_pd_list_head; iter = iter->next) {
+		struct cpg_pd *cpd_item = list_entry (iter, struct cpg_pd, list);
+
+		if (cpd_item->pid == req_lib_cpg_join->pid &&
+			mar_name_compare(&req_lib_cpg_join->group_name, &cpd_item->group_name) == 0) {
+
+			/* We have same pid and group name joined -> return error */
+			error = CPG_ERR_EXIST;
+			goto response_send;
+		}
+	}
+
 	switch (cpd->cpd_state) {
 	case CPD_STATE_UNJOINED:
 		error = CPG_OK;
@@ -978,6 +992,7 @@
 		break;
 	}
 
+response_send:
 	res_lib_cpg_join.header.size = sizeof(res_lib_cpg_join);
         res_lib_cpg_join.header.id = MESSAGE_RES_CPG_JOIN;
         res_lib_cpg_join.header.error = error;