git: d5e5e24179f4 - main - mail: tests: reset signal disposition before testing
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 29 May 2025 20:08:57 UTC
The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d5e5e24179f4a98efaadea2b3c43006b322d7f15 commit d5e5e24179f4a98efaadea2b3c43006b322d7f15 Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2025-05-29 20:08:50 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2025-05-29 20:08:50 +0000 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 --- usr.bin/mail/tests/mailx_signal_test.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/usr.bin/mail/tests/mailx_signal_test.c b/usr.bin/mail/tests/mailx_signal_test.c index d4ce1e536935..be03b54fd51e 100644 --- a/usr.bin/mail/tests/mailx_signal_test.c +++ b/usr.bin/mail/tests/mailx_signal_test.c @@ -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]);