Commit f4f73a8d authored by Sergey Lyubka's avatar Sergey Lyubka

Init vars in handle_cgi_request()

parent 74711c68
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment