diff options
author | jow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2011-07-17 07:18:59 +0000 |
---|---|---|
committer | jow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2011-07-17 07:18:59 +0000 |
commit | a80dbef8bf64db63385db61862d5b77ee10591d7 (patch) | |
tree | d78ebe06bb56c5a0c1c43667330cc4909368f1f2 /package/uhttpd/src/uhttpd-cgi.c | |
parent | 8de5d6a13780aa197a7616eade4ff1f7e096c3cf (diff) |
[package] uhttpd: unblock signals in CGI childs, solves hanging ssh logout after server restart from within LuCI and similar problems
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@27628 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/uhttpd/src/uhttpd-cgi.c')
-rw-r--r-- | package/uhttpd/src/uhttpd-cgi.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/package/uhttpd/src/uhttpd-cgi.c b/package/uhttpd/src/uhttpd-cgi.c index 8c17251b31..ed688514c4 100644 --- a/package/uhttpd/src/uhttpd-cgi.c +++ b/package/uhttpd/src/uhttpd-cgi.c @@ -157,6 +157,8 @@ void uh_cgi_request( fd_set reader; fd_set writer; + sigset_t ss; + struct sigaction sa; struct timeval timeout; struct http_response *res; @@ -187,6 +189,10 @@ void uh_cgi_request( /* exec child */ case 0: + /* unblock signals */ + sigemptyset(&ss); + sigprocmask(SIG_SETMASK, &ss, NULL); + /* restore SIGTERM */ sa.sa_flags = 0; sa.sa_handler = SIG_DFL; @@ -201,6 +207,10 @@ void uh_cgi_request( dup2(rfd[1], 1); dup2(wfd[0], 0); + /* avoid leaking our pipe into child-child processes */ + fd_cloexec(rfd[1]); + fd_cloexec(wfd[0]); + /* check for regular, world-executable file _or_ interpreter */ if( ((pi->stat.st_mode & S_IFREG) && (pi->stat.st_mode & S_IXOTH)) || (ip != NULL) |