if shmat() fails in hugeshmctl01 test, the test should exit, else -1
will return, which may cause SIGSEGV due to this line:

*(int *)test = i;

thus incorrect signal sent to parent and test gets blocked infiniately.

Signed-off-by: Caspar Zhang <[email protected]>
---
 .../kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c   |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
index 48740cd..1fd5dec 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
@@ -213,14 +213,8 @@ set_shmat()
 	/* attach the shared memory */
 	rval = shmat(shm_id_1, 0, 0);
 
-	/*
-	 * if shmat() fails, the only thing we can do is
-	 * print a message to that effect.
-	 */
-	if (rval == (void *)-1) {
-		tst_resm(TBROK, "shmat() failed - %s",strerror(errno));
-		cleanup();
-	}
+	if (rval == (void *)-1)
+		tst_brkm(TBROK|TERRNO, cleanup, "shmat() failed.")
 
 	return rval;
 }
------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to