diff options
| author | anton <> | 2021-07-29 15:33:17 +0000 |
|---|---|---|
| committer | anton <> | 2021-07-29 15:33:17 +0000 |
| commit | 83cd735c2e833bc9c4575ab3849251b6e849c4a0 (patch) | |
| tree | c10fdef0d6ce9fc791b62e667d1bff8100676276 /src/regress/lib/libc | |
| parent | 1ec9711787e6735d06c91a470baa8c76fb5f3dd5 (diff) | |
| download | openbsd-83cd735c2e833bc9c4575ab3849251b6e849c4a0.tar.gz openbsd-83cd735c2e833bc9c4575ab3849251b6e849c4a0.tar.bz2 openbsd-83cd735c2e833bc9c4575ab3849251b6e849c4a0.zip | |
Ensure that the kill signal undergoing testing is not ignored.
ok bluhm@
Diffstat (limited to 'src/regress/lib/libc')
| -rw-r--r-- | src/regress/lib/libc/sys/t_kill.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/regress/lib/libc/sys/t_kill.c b/src/regress/lib/libc/sys/t_kill.c index c92bbdd18b..871427cb8d 100644 --- a/src/regress/lib/libc/sys/t_kill.c +++ b/src/regress/lib/libc/sys/t_kill.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_kill.c,v 1.1.1.1 2019/11/19 19:57:03 bluhm Exp $ */ | 1 | /* $OpenBSD: t_kill.c,v 1.2 2021/07/29 15:33:17 anton Exp $ */ |
| 2 | /* $NetBSD: t_kill.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $ */ | 2 | /* $NetBSD: t_kill.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -60,6 +60,17 @@ ATF_TC_BODY(kill_basic, tc) | |||
| 60 | int sta; | 60 | int sta; |
| 61 | 61 | ||
| 62 | for (i = 0; i < __arraycount(sig); i++) { | 62 | for (i = 0; i < __arraycount(sig); i++) { |
| 63 | struct sigaction act, oact; | ||
| 64 | |||
| 65 | /* Ensure the signal is not ignored. */ | ||
| 66 | if (sig[i] != SIGKILL) { | ||
| 67 | memset(&act, 0, sizeof(act)); | ||
| 68 | act.sa_handler = SIG_DFL; | ||
| 69 | ATF_REQUIRE(sigaction(sig[i], &act, &oact) == 0); | ||
| 70 | } else { | ||
| 71 | ATF_REQUIRE(sigaction(sig[i], &act, &oact) != 0); | ||
| 72 | ATF_REQUIRE(errno == EINVAL); | ||
| 73 | } | ||
| 63 | 74 | ||
| 64 | pid = fork(); | 75 | pid = fork(); |
| 65 | ATF_REQUIRE(pid >= 0); | 76 | ATF_REQUIRE(pid >= 0); |
| @@ -78,6 +89,9 @@ ATF_TC_BODY(kill_basic, tc) | |||
| 78 | 89 | ||
| 79 | if (WIFSIGNALED(sta) == 0 || WTERMSIG(sta) != sig[i]) | 90 | if (WIFSIGNALED(sta) == 0 || WTERMSIG(sta) != sig[i]) |
| 80 | atf_tc_fail("kill(2) failed to kill child"); | 91 | atf_tc_fail("kill(2) failed to kill child"); |
| 92 | |||
| 93 | if (sig[i] != SIGKILL) | ||
| 94 | ATF_REQUIRE(sigaction(sig[i], &oact, NULL) == 0); | ||
| 81 | } | 95 | } |
| 82 | } | 96 | } |
| 83 | 97 | ||
