diff options
author | jow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-03-27 14:31:35 +0000 |
---|---|---|
committer | jow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-03-27 14:31:35 +0000 |
commit | f5b350a276b0f0dc27759af517c47f1812518b1d (patch) | |
tree | 1877f537ff73f8f6a75b5d9862f17ab79d532ddb /package/uhttpd/src/uhttpd.c | |
parent | f52ddee30b8dbc9af9a031cd6b0aea4f456967d1 (diff) |
[package] uhttpd: block SIGCHLD until it is expected (#6957)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20513 3c298f89-4303-0410-b956-a3cf2f4a3e73
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 97c4f836b7..be13b536d7 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; |