diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-07-17 07:18:59 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-07-17 07:18:59 +0000 |
commit | 53a5beaca89e78028495eaf8320f0b5a5d0edfab (patch) | |
tree | dae92d1cc324a7c440c53f64871b317122e7b4c5 /package/uhttpd/src | |
parent | d7fa989b42ad62c8c916dc7af6158d653426830a (diff) | |
download | mtk-20170518-53a5beaca89e78028495eaf8320f0b5a5d0edfab.zip mtk-20170518-53a5beaca89e78028495eaf8320f0b5a5d0edfab.tar.gz mtk-20170518-53a5beaca89e78028495eaf8320f0b5a5d0edfab.tar.bz2 |
uhttpd: unblock signals in CGI childs, solves hanging ssh logout after server restart from within LuCI and similar problems
SVN-Revision: 27628
Diffstat (limited to 'package/uhttpd/src')
-rw-r--r-- | package/uhttpd/src/uhttpd-cgi.c | 10 | ||||
-rw-r--r-- | package/uhttpd/src/uhttpd.c | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/package/uhttpd/src/uhttpd-cgi.c b/package/uhttpd/src/uhttpd-cgi.c index 8c17251..ed68851 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) diff --git a/package/uhttpd/src/uhttpd.c b/package/uhttpd/src/uhttpd.c index 50c3b32..4a3bced 100644 --- a/package/uhttpd/src/uhttpd.c +++ b/package/uhttpd/src/uhttpd.c @@ -621,7 +621,7 @@ static void uh_mainloop(struct config *conf, fd_set serv_fds, int max_fd) } #ifdef HAVE_TLS -static inline uh_inittls(struct config *conf) +static inline int uh_inittls(struct config *conf) { /* library handle */ void *lib; |