public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/4] libs: sigwait: Use SAFE_FORK()
@ 2020-07-23 13:42 Viresh Kumar
  2020-07-23 13:42 ` [LTP] [PATCH 2/4] libs: sigwait: Add SAFE_SIG*() macros Viresh Kumar
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Viresh Kumar @ 2020-07-23 13:42 UTC (permalink / raw)
  To: ltp

Use SAFE_FORK(), which also gets rid of a compilation warning for us.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 libs/libltpsigwait/sigwait.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/libs/libltpsigwait/sigwait.c b/libs/libltpsigwait/sigwait.c
index 5fbcdebf1295..bb8d2dd05a30 100644
--- a/libs/libltpsigwait/sigwait.c
+++ b/libs/libltpsigwait/sigwait.c
@@ -356,10 +356,8 @@ void test_bad_address2(swi_func sigwaitinfo, int signo LTP_ATTRIBUTE_UNUSED,
 	pid_t pid;
 	int status;
 
-	switch (pid = fork()) {
-	case -1:
-		tst_brk(TBROK | TERRNO, "fork() failed");
-	case 0:
+	pid = SAFE_FORK();
+	if (pid == 0) {
 		signal(SIGSEGV, SIG_DFL);
 
 		/*
@@ -374,9 +372,6 @@ void test_bad_address2(swi_func sigwaitinfo, int signo LTP_ATTRIBUTE_UNUSED,
 		tst_res(TINFO | TTERRNO, "swi_func returned: %ld",
 			TST_RET);
 		_exit(1);
-		break;
-	default:
-		break;
 	}
 
 	SAFE_WAITPID(pid, &status, 0);
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-07-24 13:37 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-23 13:42 [LTP] [PATCH 1/4] libs: sigwait: Use SAFE_FORK() Viresh Kumar
2020-07-23 13:42 ` [LTP] [PATCH 2/4] libs: sigwait: Add SAFE_SIG*() macros Viresh Kumar
2020-07-24  5:51   ` Petr Vorel
2020-07-24  8:43   ` Cyril Hrubis
2020-07-23 13:42 ` [LTP] [PATCH 3/4] libs: sigwait: Remove alarm() from setup() and cleanup() Viresh Kumar
2020-07-24  5:52   ` Petr Vorel
2020-07-24  8:44   ` Cyril Hrubis
2020-07-23 13:42 ` [LTP] [PATCH 4/4] libs: sigwait: Get rid of REPORT_SUCCESS() macro Viresh Kumar
2020-07-24  5:58   ` Petr Vorel
2020-07-24 10:34     ` Viresh Kumar
2020-07-24 12:20       ` Cyril Hrubis
2020-07-24 13:37       ` Petr Vorel
2020-07-24 12:32   ` Cyril Hrubis
2020-07-24 13:35     ` Petr Vorel
2020-07-24  5:49 ` [LTP] [PATCH 1/4] libs: sigwait: Use SAFE_FORK() Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox