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

View file

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