From fa712a0bc9ac90b2172877dc9835c38945838b39 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 21 Mar 2010 20:06:50 +0000 Subject: uhttpd: deliver SIGTERM to child when parent leaves I/O loop --- contrib/package/uhttpd/src/uhttpd-cgi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'contrib/package/uhttpd/src/uhttpd-cgi.c') 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; } } -- cgit v1.2.3