mirror of
https://github.com/cesanta/mongoose.git
synced 2025-06-12 20:59:03 +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
|
#else
|
||||||
static pid_t start_process(const char *interp, const char *cmd, const char *env,
|
static pid_t start_process(const char *interp, const char *cmd, const char *env,
|
||||||
const char *envp[], const char *dir, sock_t sock) {
|
const char *envp[], const char *dir, sock_t sock) {
|
||||||
|
char buf[500];
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
(void) env;
|
(void) env;
|
||||||
|
|
||||||
@ -732,6 +733,10 @@ static pid_t start_process(const char *interp, const char *cmd, const char *env,
|
|||||||
} else {
|
} else {
|
||||||
execle(interp, interp, cmd, NULL, envp);
|
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
|
exit(EXIT_FAILURE); // exec call failed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user