Init vars in handle_cgi_request()

This commit is contained in:
Sergey Lyubka 2013-11-23 15:04:35 +00:00
parent 74711c686f
commit f4f73a8dfa
2 changed files with 4 additions and 2 deletions

View File

@ -235,7 +235,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, fdin[2], fdout[2];
int headers_len, data_len, i, fdin[2] = {-1, -1}, fdout[2] = {-1, -1};
const char *status, *status_text;
char buf[16384], *pbuf, dir[PATH_MAX], *p;
struct mg_request_info ri;
@ -243,6 +243,7 @@ static void handle_cgi_request(struct mg_connection *conn, const char *prog) {
FILE *in = NULL, *out = NULL;
pid_t pid = (pid_t) -1;
memset(&ri, 0, sizeof(ri));
prepare_cgi_environment(conn, prog, &blk);
// CGI must be executed in its own directory. 'dir' must point to the

View File

@ -3253,7 +3253,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, fdin[2], fdout[2];
int headers_len, data_len, i, fdin[2] = {-1, -1}, fdout[2] = {-1, -1};
const char *status, *status_text;
char buf[16384], *pbuf, dir[PATH_MAX], *p;
struct mg_request_info ri;
@ -3261,6 +3261,7 @@ static void handle_cgi_request(struct mg_connection *conn, const char *prog) {
FILE *in = NULL, *out = NULL;
pid_t pid = (pid_t) -1;
memset(&ri, 0, sizeof(ri));
prepare_cgi_environment(conn, prog, &blk);
// CGI must be executed in its own directory. 'dir' must point to the