Hi !

This patch fix return value check from shmat. In case of error, this
wrong check was leading to a seg-fault.
Same problem as in kill05.

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/shmdt/shmdt01.c
===================================================================
--- cvs.orig/testcases/kernel/syscalls/ipc/shmdt/shmdt01.c	2008-03-06 18:09:48.000000000 +0100
+++ cvs/testcases/kernel/syscalls/ipc/shmdt/shmdt01.c	2008-03-06 18:11:28.000000000 +0100
@@ -52,6 +52,10 @@
  * HISTORY
  *	03/2001 - Written by Wayne Boyer
  *
+ *      06/03/2008 Renaud Lottiaux ([EMAIL PROTECTED])
+ *      - Fix wrong return value check on shmat system call (leading to 
+ *        segfault in case of error with this syscall).
+ *
  * RESTRICTIONS
  *	none
  */
@@ -111,7 +115,7 @@
 		/* reattach the shared memory segment in case we are looping */
 		shared = (int *)shmat(shm_id_1, 0, 0);
 
-		if (*shared == -1) {
+		if (shared == (void *)-1) {
 			tst_brkm(TBROK, cleanup, "memory reattach failed");
 		}
 
@@ -216,7 +220,7 @@
 	/* attach the shared memory segment */
 	shared = (int *)shmat(shm_id_1, 0, 0);
 
-	if (*shared == -1) {
+	if (shared == (void *)-1) {
 		tst_brkm(TBROK, cleanup, "Couldn't attach shared memory");
 	}
 

Attachment: signature.asc
Description: This is a digitally signed message part.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to