summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/uhttpd/src/uhttpd-cgi.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-03-21 20:06:50 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-03-21 20:06:50 +0000
commitfa712a0bc9ac90b2172877dc9835c38945838b39 (patch)
tree3cd262e575937d8da7adcdea600d638904a34508 /contrib/package/uhttpd/src/uhttpd-cgi.c
parentd87fefbda608d1bbf296cc7fbb766e72b8b94c13 (diff)
uhttpd: deliver SIGTERM to child when parent leaves I/O loop
Diffstat (limited to 'contrib/package/uhttpd/src/uhttpd-cgi.c')
-rw-r--r--contrib/package/uhttpd/src/uhttpd-cgi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/contrib/package/uhttpd/src/uhttpd-cgi.c b/contrib/package/uhttpd/src/uhttpd-cgi.c
index a6e5d99e0..a239c8bc9 100644
--- a/contrib/package/uhttpd/src/uhttpd-cgi.c
+++ b/contrib/package/uhttpd/src/uhttpd-cgi.c
@@ -150,6 +150,8 @@ void uh_cgi_request(struct client *cl, struct http_request *req, struct path_inf
char buf[UH_LIMIT_MSGHEAD];
char hdr[UH_LIMIT_MSGHEAD];
+ pid_t child;
+
fd_set reader;
fd_set writer;
@@ -172,7 +174,7 @@ void uh_cgi_request(struct client *cl, struct http_request *req, struct path_inf
}
/* fork off child process */
- switch( fork() )
+ switch( (child = fork()) )
{
/* oops */
case -1:
@@ -543,6 +545,9 @@ void uh_cgi_request(struct client *cl, struct http_request *req, struct path_inf
close(rfd[0]);
close(wfd[1]);
+ if( !kill(child, 0) )
+ kill(child, SIGTERM);
+
break;
}
}