mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Use sigaction(2) instead of signal(3) to avoid the signal handler being
re-entered.
This commit is contained in:
parent
93c9745e20
commit
5b3df62e01
1 changed files with 10 additions and 3 deletions
|
|
@ -94,6 +94,7 @@ int doclean; /* Should cleanup() remove output? */
|
|||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct sigaction sa;
|
||||
long i;
|
||||
int ch;
|
||||
const char *expr;
|
||||
|
|
@ -145,9 +146,15 @@ main(int argc, char *argv[])
|
|||
if (!kflag) {
|
||||
doclean = 1;
|
||||
atexit(cleanup);
|
||||
signal(SIGHUP, handlesig);
|
||||
signal(SIGINT, handlesig);
|
||||
signal(SIGTERM, handlesig);
|
||||
sa.sa_flags = 0;
|
||||
sa.sa_handler = handlesig;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaddset(&sa.sa_mask, SIGHUP);
|
||||
sigaddset(&sa.sa_mask, SIGINT);
|
||||
sigaddset(&sa.sa_mask, SIGTERM);
|
||||
sigaction(SIGHUP, &sa, NULL);
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
}
|
||||
|
||||
lineno = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue