aboutsummaryrefslogtreecommitdiffstats
path: root/package/uhttpd/src/uhttpd.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-03-27 14:31:35 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-03-27 14:31:35 +0000
commit4172149f89b14c2760578f6dc99427794f83de2b (patch)
tree0c37368e3ac708aa90d33474a97ef178d299c226 /package/uhttpd/src/uhttpd.c
parent27d3adb4507f8c9940075de097b83a9bf776566b (diff)
downloadupstream-4172149f89b14c2760578f6dc99427794f83de2b.tar.gz
upstream-4172149f89b14c2760578f6dc99427794f83de2b.tar.bz2
upstream-4172149f89b14c2760578f6dc99427794f83de2b.zip
uhttpd: block SIGCHLD until it is expected (#6957)
SVN-Revision: 20513
Diffstat (limited to 'package/uhttpd/src/uhttpd.c')
-rw-r--r--package/uhttpd/src/uhttpd.c10
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;