summaryrefslogtreecommitdiff
path: root/regress/lib/libc
diff options
context:
space:
mode:
authoranton <anton@cvs.openbsd.org>2021-07-29 15:33:18 +0000
committeranton <anton@cvs.openbsd.org>2021-07-29 15:33:18 +0000
commitbe2b9de39572847afdcb1ce9e44d916361311506 (patch)
treea0d4af89565914b99f507f5f4e958f2abfb1608f /regress/lib/libc
parent0a784eaab4af68365c9e8050c5b548f4560bf1ef (diff)
Ensure that the kill signal undergoing testing is not ignored.
ok bluhm@
Diffstat (limited to 'regress/lib/libc')
-rw-r--r--regress/lib/libc/sys/t_kill.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/regress/lib/libc/sys/t_kill.c b/regress/lib/libc/sys/t_kill.c
index 2f30b062ca7..871427cb8d8 100644
--- a/regress/lib/libc/sys/t_kill.c
+++ b/regress/lib/libc/sys/t_kill.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: t_kill.c,v 1.1 2019/11/19 19:57:03 bluhm Exp $ */
+/* $OpenBSD: t_kill.c,v 1.2 2021/07/29 15:33:17 anton Exp $ */
/* $NetBSD: t_kill.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $ */
/*-
@@ -60,6 +60,17 @@ ATF_TC_BODY(kill_basic, tc)
int sta;
for (i = 0; i < __arraycount(sig); i++) {
+ struct sigaction act, oact;
+
+ /* Ensure the signal is not ignored. */
+ if (sig[i] != SIGKILL) {
+ memset(&act, 0, sizeof(act));
+ act.sa_handler = SIG_DFL;
+ ATF_REQUIRE(sigaction(sig[i], &act, &oact) == 0);
+ } else {
+ ATF_REQUIRE(sigaction(sig[i], &act, &oact) != 0);
+ ATF_REQUIRE(errno == EINVAL);
+ }
pid = fork();
ATF_REQUIRE(pid >= 0);
@@ -78,6 +89,9 @@ ATF_TC_BODY(kill_basic, tc)
if (WIFSIGNALED(sta) == 0 || WTERMSIG(sta) != sig[i])
atf_tc_fail("kill(2) failed to kill child");
+
+ if (sig[i] != SIGKILL)
+ ATF_REQUIRE(sigaction(sig[i], &oact, NULL) == 0);
}
}