summaryrefslogtreecommitdiff
path: root/uhttpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'uhttpd.c')
-rw-r--r--uhttpd.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/uhttpd.c b/uhttpd.c
index 97c4f83..be13b53 100644
--- a/uhttpd.c
+++ b/uhttpd.c
@@ -410,6 +410,9 @@ int main (int argc, char **argv)
struct sigaction sa;
struct config conf;
+ /* signal mask */
+ sigset_t ss;
+
/* maximum file descriptor number */
int new_fd, cur_fd, max_fd = 0;
@@ -432,7 +435,7 @@ int main (int argc, char **argv)
FD_ZERO(&serv_fds);
FD_ZERO(&read_fds);
- /* handle SIGPIPE, SIGCHILD */
+ /* handle SIGPIPE, SIGINT, SIGTERM, SIGCHLD */
sa.sa_flags = 0;
sigemptyset(&sa.sa_mask);
@@ -446,6 +449,11 @@ int main (int argc, char **argv)
sigaction(SIGINT, &sa, NULL);
sigaction(SIGTERM, &sa, NULL);
+ /* defer SIGCHLD */
+ sigemptyset(&ss);
+ sigaddset(&ss, SIGCHLD);
+ sigprocmask(SIG_BLOCK, &ss, NULL);
+
/* prepare addrinfo hints */
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;