Commit 71b6a536 authored by valenok's avatar valenok

spawn_process(): reading hashbang string correctly on Windows

parent 5303e377
...@@ -1172,6 +1172,7 @@ static pid_t spawn_process(struct mg_connection *conn, const char *prog, ...@@ -1172,6 +1172,7 @@ static pid_t spawn_process(struct mg_connection *conn, const char *prog,
interp = conn->ctx->config[CGI_INTERPRETER]; interp = conn->ctx->config[CGI_INTERPRETER];
if (interp == NULL) { if (interp == NULL) {
buf[2] = '\0'; buf[2] = '\0';
mg_snprintf(conn, cmdline, sizeof(cmdline), "%s%c%s", dir, DIRSEP, prog);
if ((fp = fopen(cmdline, "r")) != NULL) { if ((fp = fopen(cmdline, "r")) != NULL) {
(void) fgets(buf, sizeof(buf), fp); (void) fgets(buf, sizeof(buf), fp);
if (buf[0] != '#' || buf[1] != '!') { if (buf[0] != '#' || buf[1] != '!') {
......
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