Date: Wed, 21 May 2025 17:47:38 GMT From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= <des@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: b71d73af2f68 - stable/14 - mail: exit with the correct exit status on SIGHUP in send mode Message-ID: <202505211747.54LHlcdP074969@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=b71d73af2f68d473eda5fd7547a2fd7ec92b70d5 commit b71d73af2f68d473eda5fd7547a2fd7ec92b70d5 Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2025-05-14 19:20:16 +0000 Commit: Dag-Erling Smørgrav <des@FreeBSD.org> CommitDate: 2025-05-21 17:33:09 +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 (cherry picked from commit 964557fe9807d473ad11182a332b0d1da4f54ef0) --- 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 e6a6337bcdb0..1155467efcb3 100644 --- a/usr.bin/mail/collect.c +++ b/usr.bin/mail/collect.c @@ -704,7 +704,7 @@ collint(int s __unused) /*ARGSUSED*/ void -collhup(int s __unused) +collhup(int signo) { rewind(collf); savedeadletter(collf); @@ -712,7 +712,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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505211747.54LHlcdP074969>