diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-03-21 20:52:41 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-03-21 20:52:41 +0000 |
commit | d817ebf0070cd6c70b49fb3c4e13becb0544e429 (patch) | |
tree | 35c44df1e2f168da2e360228e6acce0c5eacef23 /contrib/package | |
parent | fa712a0bc9ac90b2172877dc9835c38945838b39 (diff) |
uhttpd: properly initialize sigaction, restore SIGTERM for childs
Diffstat (limited to 'contrib/package')
-rw-r--r-- | contrib/package/uhttpd/src/uhttpd-cgi.c | 9 | ||||
-rw-r--r-- | contrib/package/uhttpd/src/uhttpd-lua.c | 9 | ||||
-rw-r--r-- | contrib/package/uhttpd/src/uhttpd.c | 3 |
3 files changed, 19 insertions, 2 deletions
diff --git a/contrib/package/uhttpd/src/uhttpd-cgi.c b/contrib/package/uhttpd/src/uhttpd-cgi.c index a239c8bc9..5565197ca 100644 --- a/contrib/package/uhttpd/src/uhttpd-cgi.c +++ b/contrib/package/uhttpd/src/uhttpd-cgi.c @@ -155,6 +155,7 @@ void uh_cgi_request(struct client *cl, struct http_request *req, struct path_inf fd_set reader; fd_set writer; + struct sigaction sa; struct timeval timeout; struct http_response *res; @@ -184,7 +185,13 @@ void uh_cgi_request(struct client *cl, struct http_request *req, struct path_inf /* exec child */ case 0: - /* child */ + /* restore SIGTERM */ + sa.sa_flags = 0; + sa.sa_handler = SIG_DFL; + sigemptyset(&sa.sa_mask); + sigaction(SIGTERM, &sa, NULL); + + /* close loose pipe ends */ close(rfd[0]); close(wfd[1]); diff --git a/contrib/package/uhttpd/src/uhttpd-lua.c b/contrib/package/uhttpd/src/uhttpd-lua.c index 1334aeeb4..db14eda45 100644 --- a/contrib/package/uhttpd/src/uhttpd-lua.c +++ b/contrib/package/uhttpd/src/uhttpd-lua.c @@ -229,6 +229,7 @@ void uh_lua_request(struct client *cl, struct http_request *req, lua_State *L) fd_set reader; fd_set writer; + struct sigaction sa; struct timeval timeout; @@ -255,7 +256,13 @@ void uh_lua_request(struct client *cl, struct http_request *req, lua_State *L) break; case 0: - /* child */ + /* restore SIGTERM */ + sa.sa_flags = 0; + sa.sa_handler = SIG_DFL; + sigemptyset(&sa.sa_mask); + sigaction(SIGTERM, &sa, NULL); + + /* close loose pipe ends */ close(rfd[0]); close(wfd[1]); diff --git a/contrib/package/uhttpd/src/uhttpd.c b/contrib/package/uhttpd/src/uhttpd.c index ea4ca00c0..401749fae 100644 --- a/contrib/package/uhttpd/src/uhttpd.c +++ b/contrib/package/uhttpd/src/uhttpd.c @@ -423,6 +423,9 @@ int main (int argc, char **argv) FD_ZERO(&read_fds); /* handle SIGPIPE, SIGCHILD */ + sa.sa_flags = 0; + sigemptyset(&sa.sa_mask); + sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, NULL); sigaction(SIGCHLD, &sa, NULL); |