mirror of
https://git.freebsd.org/src.git
synced 2026-01-11 19:57:22 +00:00
mail: tests: reset signal disposition before testing
As a good citizen of the OS, mail(1) won't try to catch signals that were ignored when it started and it won't reconfigure its signal mask unless it's going to try and handle a signal. The test should start mail(1) off in a well-known state for the signal that it's trying to test in order to get the behavior that's desired. No functional change, just improves the resilience of the test. Reviewed by: des Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50599
This commit is contained in:
parent
2e47009079
commit
d5e5e24179
1 changed files with 11 additions and 0 deletions
|
|
@ -50,6 +50,17 @@ mailx_signal_test(int signo, bool interactive)
|
|||
atf_tc_fail("failed to fork");
|
||||
if (pid == 0) {
|
||||
/* child */
|
||||
sigset_t set;
|
||||
|
||||
/*
|
||||
* Ensure mailx(1) will handle SIGINT; i.e., that it's not
|
||||
* ignored or blocked.
|
||||
*/
|
||||
(void)signal(signo, SIG_DFL);
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set, signo);
|
||||
ATF_REQUIRE_INTEQ(0, sigprocmask(SIG_UNBLOCK, &set, NULL));
|
||||
|
||||
dup2(ipd[0], STDIN_FILENO);
|
||||
close(ipd[0]);
|
||||
close(ipd[1]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue