commit - 2fbb00a4292fb45faa409c8983136a105cbda7ba
commit + 736fac9082f40fedb3e0fe65f715dc403eb7b250
blob - a0576465ae834d0f074a2d8dc1fbbb6ecec3186a
blob + 156dad3dc6bd9624457ed102668c97c9f301eda3
--- gotwebd/sockets.c
+++ gotwebd/sockets.c
void
sockets(struct gotwebd *env, int fd)
{
- struct event sighup, sigusr1, sigchld;
+ struct event sighup, sigint, sigusr1, sigchld, sigterm;
event_init();
signal_set(&sighup, SIGHUP, sockets_sighdlr, env);
signal_add(&sighup, NULL);
+ signal_set(&sigint, SIGINT, sockets_sighdlr, env);
+ signal_add(&sigint, NULL);
signal_set(&sigusr1, SIGUSR1, sockets_sighdlr, env);
signal_add(&sigusr1, NULL);
signal_set(&sigchld, SIGCHLD, sockets_sighdlr, env);
signal_add(&sigchld, NULL);
+ signal_set(&sigterm, SIGTERM, sockets_sighdlr, env);
+ signal_add(&sigterm, NULL);
#ifndef PROFILE
if (pledge("stdio rpath inet recvfd proc exec sendfd unveil",
log_info("%s: ignoring SIGUSR1", __func__);
break;
case SIGCHLD:
+ break;
+ case SIGINT:
+ case SIGTERM:
+ sockets_shutdown();
break;
default:
log_info("SIGNAL: %d", sig);
free(srv);
free(gotwebd_env);
+
+ exit(0);
}
int