mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-24 20:21:49 +00:00
Under Linux, reap CGI zombies reliably
This commit is contained in:
1 parent
66ba1259f2
commit
51b1f3a021
2 files changed
+5
-13
No files matched your search
+4
-1
@@ -2832,7 +2832,7 @@ static void prepare_cgi_environment(struct mg_connection *conn,
|
||||
}
|
||||
|
||||
static void handle_cgi_request(struct mg_connection *conn, const char *prog) {
|
||||
int headers_len, data_len, i, fd_stdin[2], fd_stdout[2];
|
||||
int headers_len, data_len, i, exit_status, fd_stdin[2], fd_stdout[2];
|
||||
const char *status;
|
||||
char buf[BUFSIZ], *pbuf, dir[PATH_MAX], *p;
|
||||
struct mg_request_info ri;
|
||||
@@ -2925,6 +2925,9 @@ static void handle_cgi_request(struct mg_connection *conn, const char *prog) {
|
||||
done:
|
||||
if (pid != (pid_t) -1) {
|
||||
kill(pid, SIGKILL);
|
||||
#if !defined(_WIN32)
|
||||
do {} while (waitpid(-1, &exit_status, WNOHANG) > 0);
|
||||
#endif
|
||||
}
|
||||
if (fd_stdin[0] != -1) {
|
||||
(void) close(fd_stdin[0]);
|
||||
|
||||
Reference in new issue
Block a user