Skip to contentSkip to conversation

sigrelse01.c: cleanup() should be called only once

PATCH In review Peng Haitao 2 participants 2 messages Jan 28, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sigrelse01.c: cleanup() should be called only once

Hi Garrett,

cleanup() call the function tst_rmdir() to remove the temporary directory, so cleanup() should be called only once.

---
 testcases/kernel/syscalls/sigrelse/sigrelse01.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)
testcases/kernel/syscalls/sigrelse/sigrelse01.c +3 -8
index 0d0e12b..da612df 100644
@@ -373,9 +373,6 @@ static void parent()
 		tst_resm(TBROK, "Unexpected exit code %d from child", rv);
 		break;
 	}
-
-	cleanup();
-
 }				/* end of parent */
 
 /****************************************************************************
@@ -797,8 +794,7 @@ void setup()
 
 	/* set up pipe for parent/child communications */
 	if (pipe(pipe_fd) < 0) {
-		tst_resm(TBROK|TERRNO, "pipe() failed");
-		cleanup();
+		tst_brkm(TBROK|TERRNO, cleanup, "pipe() failed");
 	}
 
 	/*
@@ -812,8 +808,7 @@ void setup()
 
 	/* set up pipe for parent/child communications */
 	if (pipe(pipe_fd2) < 0) {
-		tst_resm(TBROK|TERRNO, "pipe() failed");
-		cleanup();
+		tst_brkm(TBROK|TERRNO, cleanup, "pipe() failed");
 	}
 
 	/*
@@ -840,4 +835,4 @@ void cleanup()
 
 	tst_rmdir();
 
-}
\ No newline at end of file
+}
Signature · 17 lines
1.7.0.1

-- 
Best Regards,
Peng Haitao


------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw
Quoted 4 lines · Peng Haitao

Hi Garrett,

cleanup() call the function tst_rmdir() to remove the temporary directory, so cleanup() should be called only once.

I did some style cleanup, but I'm concerned that the signal
handler code setup might not function as expected because it used to build off of choose_sig. Please verify whether or not things work for you now.
Thanks,
-Garrett

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list