src/server/safs/cgi.c

changeset 385
a1f4cb076d2f
parent 359
79b28ae7bfbd
child 415
d938228c382e
--- a/src/server/safs/cgi.c	Tue Aug 13 22:14:32 2019 +0200
+++ b/src/server/safs/cgi.c	Sat Sep 24 16:26:10 2022 +0200
@@ -36,9 +36,10 @@
 #include <signal.h>
 #include <sys/wait.h>
 
+#include <ucx/string.h>
+
 #include "../util/util.h"
 #include "../util/pblock.h"
-#include "../../ucx/string.h"
 #include "../daemon/netsite.h"
 #include "../util/io.h"
 
@@ -190,7 +191,12 @@
         log_ereport(LOG_FAILURE, "cgi-send: kill script: %s", path);
         kill(cgip.pid, SIGKILL);
     }
-    cgi_close(&cgip); // TODO: check return value
+    
+    int exit_code = cgi_close(&cgip);
+    if(exit_code != 0) {
+        log_ereport(LOG_FAILURE, "send-cgi: script: %s exited with code %d", path, exit_code);
+        ret = REQ_ABORTED;
+    }
       
     cgi_parser_free(parser);
     return result;
@@ -268,7 +274,7 @@
         system_close(p->out[1]);
     }
     
-    return 0;
+    return status;
 }
 
 CGIResponseParser* cgi_parser_new(Session *sn, Request *rq) {

mercurial