HomeFreeBSD

mail: exit with the correct exit status on SIGHUP in send mode

Description

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)

Details

Provenance
kevansAuthored on May 14 2025, 7:20 PM
desCommitted on May 21 2025, 5:33 PM
Reviewer
des
Differential Revision
D50251: mail: exit with the correct exit status on SIGHUP
Parents
rGa7a3eec3fc37: mail: remove the SIGHUP handler from lex.c
Branches
Unknown
Tags
Unknown