mail: remove the SIGHUP handler from lex.c

If the command is simply going to exit without doing any cleanup, then
an immediate exit(3) does not add any value and in-fact obscures that
the program was terminated by a signal.

This is motivated by POSIX conformance requirements, but it's also a
little bit of a tidy-up.  Some investigation into the history of mail(1)
shows that, at one point, hangup() would attempt to save messages into
mbox before exiting.  It was later transformed into a simple exit() and
likely could have been GC'd at that point.

Reviewed by:	des, emaste, ivy
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D50247
This commit is contained in:
Kyle Evans 2025-05-14 14:20:16 -05:00
parent dd3d1a7694
commit df16cbdcf1
2 changed files with 0 additions and 14 deletions

View file

@ -131,7 +131,6 @@ int getrawlist(char *, char **, int);
uid_t getuserid(char *);
int grabh(struct header *, int);
int group(void *);
void hangup(int);
int hash(const char *);
void hdrstop(int);
int headers(void *);

View file

@ -199,8 +199,6 @@ commands(void)
if (!sourcing) {
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
(void)signal(SIGINT, intr);
if (signal(SIGHUP, SIG_IGN) != SIG_IGN)
(void)signal(SIGHUP, hangup);
(void)signal(SIGTSTP, stop);
(void)signal(SIGTTOU, stop);
(void)signal(SIGTTIN, stop);
@ -567,17 +565,6 @@ stop(int s)
}
}
/*
* Branch here on hangup signal and simulate "exit".
*/
void
hangup(int s __unused)
{
/* nothing to do? */
exit(1);
}
/*
* Announce the presence of the current Mail version,
* give the message count, and print a header listing.