Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
51b1f3a0
Commit
51b1f3a0
authored
Sep 26, 2010
by
valenok
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Under Linux, reap CGI zombies reliably
parent
66ba1259
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
13 deletions
+5
-13
main.c
main.c
+1
-12
mongoose.c
mongoose.c
+4
-1
No files found.
main.c
View file @
51b1f3a0
...
...
@@ -65,15 +65,7 @@ static struct mg_context *ctx; // Set by start_mongoose()
#endif
/* !CONFIG_FILE */
static
void
WINCDECL
signal_handler
(
int
sig_num
)
{
#if !defined(_WIN32)
if
(
sig_num
==
SIGCHLD
)
{
do
{
}
while
(
waitpid
(
-
1
,
&
sig_num
,
WNOHANG
)
>
0
);
}
else
#endif
/* !_WIN32 */
{
exit_flag
=
sig_num
;
}
}
static
void
die
(
const
char
*
fmt
,
...)
{
...
...
@@ -260,9 +252,6 @@ static void start_mongoose(int argc, char *argv[]) {
process_command_line_arguments
(
argv
,
options
);
/* Setup signal handler: quit on Ctrl-C */
#ifndef _WIN32
signal
(
SIGCHLD
,
signal_handler
);
#endif
/* _WIN32 */
signal
(
SIGTERM
,
signal_handler
);
signal
(
SIGINT
,
signal_handler
);
...
...
mongoose.c
View file @
51b1f3a0
...
...
@@ -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
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment