mirror of
https://github.com/cesanta/mongoose.git
synced 2024-11-28 13:49:01 +08:00
Better CGI error diagnostic for UNIX
This commit is contained in:
parent
4cd11de400
commit
2f69ca37d3
@ -712,6 +712,7 @@ static pid_t start_process(char *interp, const char *cmd, const char *env,
|
||||
#else
|
||||
static pid_t start_process(const char *interp, const char *cmd, const char *env,
|
||||
const char *envp[], const char *dir, sock_t sock) {
|
||||
char buf[500];
|
||||
pid_t pid = fork();
|
||||
(void) env;
|
||||
|
||||
@ -732,6 +733,10 @@ static pid_t start_process(const char *interp, const char *cmd, const char *env,
|
||||
} else {
|
||||
execle(interp, interp, cmd, NULL, envp);
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "Status: 500\r\n\r\n"
|
||||
"500 Server Error: %s%s%s: %s", interp == NULL ? "" : interp,
|
||||
interp == NULL ? "" : " ", cmd, strerror(errno));
|
||||
send(1, buf, strlen(buf), 0);
|
||||
exit(EXIT_FAILURE); // exec call failed
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user