check cgi exit code webdav

Sat, 14 May 2022 15:21:59 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 14 May 2022 15:21:59 +0200
branch
webdav
changeset 359
79b28ae7bfbd
parent 358
f3b490a2150c
child 360
79ddd772e807

check cgi exit code

src/server/safs/cgi.c file | annotate | diff | comparison | revisions
--- a/src/server/safs/cgi.c	Sat May 14 12:51:05 2022 +0200
+++ b/src/server/safs/cgi.c	Sat May 14 15:21:59 2022 +0200
@@ -191,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;
@@ -269,7 +274,7 @@
         system_close(p->out[1]);
     }
     
-    return 0;
+    return status;
 }
 
 CGIResponseParser* cgi_parser_new(Session *sn, Request *rq) {

mercurial