Bladeren bron

Fixed spawn_proccess() for win32 for .exe binaries

Sergey Lyubka 12 jaren geleden
bovenliggende
commit
30d1573346
1 gewijzigde bestanden met toevoegingen van 3 en 1 verwijderingen
  1. 3 1
      mongoose.c

+ 3 - 1
mongoose.c

@@ -1255,7 +1255,7 @@ static pid_t spawn_process(struct mg_connection *conn, const char *prog,
   // If CGI file is a script, try to read the interpreter line
   interp = conn->ctx->config[CGI_INTERPRETER];
   if (interp == NULL) {
-    buf[0] = buf[2] = '\0';
+    buf[0] = buf[1] = '\0';
 
     // Read the first line of the script into the buffer
     snprintf(cmdline, sizeof(cmdline), "%s%c%s", dir, '/', prog);
@@ -1270,6 +1270,8 @@ static pid_t spawn_process(struct mg_connection *conn, const char *prog,
       for (p = buf + 2; *p != '\0' && isspace(* (unsigned char *) p); )
         p++;
       *p = '\0';
+    } else {
+      buf[2] = '\0';
     }
     interp = buf + 2;
   }