catch SIGTERM for clean exit

This commit is contained in:
Jethro Grassie 2020-10-11 02:09:37 -04:00
parent 08fa5c12fb
commit c3c3318b68
No known key found for this signature in database
GPG Key ID: DE8ED755616565BB
1 changed files with 2 additions and 1 deletions

View File

@ -4030,7 +4030,7 @@ sigusr1_handler(evutil_socket_t fd, short event, void *arg)
static void
sigint_handler(int sig)
{
signal(SIGINT, SIG_DFL);
signal(sig, SIG_DFL);
exit(0);
}
@ -4421,6 +4421,7 @@ int main(int argc, char **argv)
log_set_udata(&mutex_log);
log_set_lock(log_lock);
signal(SIGINT, sigint_handler);
signal(SIGTERM, sigint_handler);
signal(SIGPIPE, SIG_IGN);
atexit(cleanup);