commit - 53f578a6d94eeb340775f5e05c24fb9a5df33236
commit + 7a4d2c244110a34fed1abc76faa9824c417d83dc
blob - c2397c84d7c5b27ebd5bbaf41e79d15f5d275a82
blob + e69a8e9f0c23d323ad013f7751187f5a401d5fa1
--- 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