Some archs have different requirements for the SETVAL parameters of
semctl.  This patch fixes those archs to not segfault.

Regards
-steve

Index: lib/coroipc.c
===================================================================
--- lib/coroipc.c	(revision 1880)
+++ lib/coroipc.c	(working copy)
@@ -265,6 +265,15 @@
 	ipc_segment->euid = req_priv_change.euid;
 	return (0);
 }
+
+#if defined(_SEM_SEMUN_UNDEFINED)
+union semun {
+        int val;
+        struct semid_ds *buf;
+        unsigned short int *array;
+        struct seminfo *__buf;
+};
+#endif
 	
 cs_error_t
 cslib_service_connect (
@@ -280,6 +289,7 @@
 	int res;
 	mar_req_setup_t req_setup;
 	mar_res_setup_t res_setup;
+	union semun semun;
 
 	res_setup.error = CS_ERR_LIBRARY;
 
@@ -338,12 +348,13 @@
 		goto error_exit;
 	}
 	
-	res = semctl (ipc_segment->semid, 0, SETVAL, 0);
+	semun.val = 0;
+	res = semctl (ipc_segment->semid, 0, SETVAL, semun);
 	if (res != 0) {
 		goto error_exit;
 	}
 
-	res = semctl (ipc_segment->semid, 1, SETVAL, 0);
+	res = semctl (ipc_segment->semid, 1, SETVAL, semun);
 	if (res != 0) {
 		goto error_exit;
 	}
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to