git: 964557fe9807 - main - mail: exit with the correct exit status on SIGHUP in send mode
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 14 May 2025 19:20:48 UTC
The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=964557fe9807d473ad11182a332b0d1da4f54ef0 commit 964557fe9807d473ad11182a332b0d1da4f54ef0 Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2025-05-14 19:20:16 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2025-05-14 19:20:35 +0000 mail: exit with the correct exit status on SIGHUP in send mode Motivated by POSIX conformance requirements: mailx(1) is expected to take the default action for every signal except SIGINT in interactive mode. We still handle other signals that we shouldn't based on the spec (e.g., SIGTSTP), but conforming there is not as straightforward as we do more than just cleanup in response. Note that when the spec says that we must take the default action, it does not mean so strictly. Namely, we *can* do some sensible cleanup if we'd like, but we enter into nonconformant territory if we don't reflect the termination via signal in our exit status. That is why this change doesn't actually remove the handler; we're still conformant as long as the end result is the same as if we took the default action. Reviewed by: des Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50251 --- usr.bin/mail/collect.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.bin/mail/collect.c b/usr.bin/mail/collect.c index 2423bcf7b262..97c4d499ea3a 100644 --- a/usr.bin/mail/collect.c +++ b/usr.bin/mail/collect.c @@ -698,7 +698,7 @@ collint(int s __unused) /*ARGSUSED*/ void -collhup(int s __unused) +collhup(int signo) { rewind(collf); savedeadletter(collf); @@ -706,7 +706,8 @@ collhup(int s __unused) * Let's pretend nobody else wants to clean up, * a true statement at this time. */ - exit(1); + signal(signo, SIG_DFL); + raise(signo); } void