Hi !

Fix concurrency issue. The second key used for this test could
conflict with the key from another task.

Signed-off-by: Matthieu Fertré <[EMAIL PROTECTED]>

R.

-- 
Renaud Lottiaux

Kerlabs
Bâtiment Germanium
80, avenue des buttes de Coësmes
35700 Rennes - France
Phone : (+33|0)6 80 89 19 34
Fax   : (+33|0)2 99 84 71 71
Email : [EMAIL PROTECTED]
Web   : http://www.kerlabs.com/
Index: cvs/testcases/kernel/syscalls/ipc/msgrcv/msgrcv02.c
===================================================================
--- cvs.orig/testcases/kernel/syscalls/ipc/msgrcv/msgrcv02.c	2002-11-18 20:55:00.000000000 +0100
+++ cvs/testcases/kernel/syscalls/ipc/msgrcv/msgrcv02.c	2008-03-28 14:53:23.000000000 +0100
@@ -48,6 +48,10 @@
  *
  * HISTORY
  *	03/2001 - Written by Wayne Boyer
+ *      14/03/2008 Matthieu Fertré ([EMAIL PROTECTED])
+ *      - Fix concurrency issue. The second key used for this test could
+ *        conflict with the key from another task.
+
  *
  * RESTRICTIONS
  *	none
@@ -147,6 +151,8 @@
 void
 setup(void)
 {
+	key_t msgkey2;
+
 	/* capture signals */
 	tst_sig(NOFORK, DEF_HANDLER, cleanup);
 
@@ -178,6 +184,9 @@
 
 	msgkey = getipckey();
 
+       /* Get an new IPC resource key. */
+	msgkey2 = getipckey();
+
 	/* create a message queue with read/write permission */
 	if ((msg_q_1 = msgget(msgkey, IPC_CREAT | IPC_EXCL | MSG_RW)) == -1) {
 		tst_brkm(TBROK, cleanup, "Can't create message queue #1");
@@ -192,7 +201,7 @@
 	}
 
 	/* create a message queue without read/write permission */
-	if ((msg_q_2 = msgget(msgkey + 1, IPC_CREAT | IPC_EXCL)) == -1) {
+	if ((msg_q_2 = msgget(msgkey2, IPC_CREAT | IPC_EXCL)) == -1) {
 		tst_brkm(TBROK, cleanup, "Can't create message queue #2");
 	}
 }
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to