diff options
Diffstat (limited to 'package/uhttpd/src/uhttpd.c')
-rw-r--r-- | package/uhttpd/src/uhttpd.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/package/uhttpd/src/uhttpd.c b/package/uhttpd/src/uhttpd.c index 97c4f836b..be13b536d 100644 --- a/package/uhttpd/src/uhttpd.c +++ b/package/uhttpd/src/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; |