From e3ba9f336ccb8eab7633e3c2885c7ef92436e6a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sat, 5 Mar 2022 18:28:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.c b/server.c index f9128a7..3b22d0a 100644 --- a/server.c +++ b/server.c @@ -236,7 +236,6 @@ static void error_die(const char *sc) { static void execute_cgi(int client, int content_length, const HTTP_REQUEST* request) { int cgi_output[2], cgi_input[2]; pid_t pid; - char buf[1024]; if(pipe(cgi_output) < 0 || pipe(cgi_input) < 0 || (pid = fork()) < 0) { internal_error(client); @@ -250,9 +249,10 @@ static void execute_cgi(int client, int content_length, const HTTP_REQUEST* requ close(cgi_input[1]); execl(request->path, request->path, request->method, request->query_string, NULL); - exit(EXIT_SUCCESS); + exit(EXIT_FAILURE); // a success execl will never return } /* parent */ + char buf[1024]; close(cgi_output[1]); close(cgi_input[0]); if(request->method_type == POST) {