src/server/safs/cgi.c

changeset 385
a1f4cb076d2f
parent 359
79b28ae7bfbd
child 415
d938228c382e
equal deleted inserted replaced
210:21274e5950af 385:a1f4cb076d2f
34 34
35 #include <sys/types.h> 35 #include <sys/types.h>
36 #include <signal.h> 36 #include <signal.h>
37 #include <sys/wait.h> 37 #include <sys/wait.h>
38 38
39 #include <ucx/string.h>
40
39 #include "../util/util.h" 41 #include "../util/util.h"
40 #include "../util/pblock.h" 42 #include "../util/pblock.h"
41 #include "../../ucx/string.h"
42 #include "../daemon/netsite.h" 43 #include "../daemon/netsite.h"
43 #include "../util/io.h" 44 #include "../util/io.h"
44 45
45 #include "cgiutils.h" 46 #include "cgiutils.h"
46 47
188 189
189 if(result == REQ_ABORTED) { 190 if(result == REQ_ABORTED) {
190 log_ereport(LOG_FAILURE, "cgi-send: kill script: %s", path); 191 log_ereport(LOG_FAILURE, "cgi-send: kill script: %s", path);
191 kill(cgip.pid, SIGKILL); 192 kill(cgip.pid, SIGKILL);
192 } 193 }
193 cgi_close(&cgip); // TODO: check return value 194
195 int exit_code = cgi_close(&cgip);
196 if(exit_code != 0) {
197 log_ereport(LOG_FAILURE, "send-cgi: script: %s exited with code %d", path, exit_code);
198 ret = REQ_ABORTED;
199 }
194 200
195 cgi_parser_free(parser); 201 cgi_parser_free(parser);
196 return result; 202 return result;
197 } 203 }
198 204
266 } 272 }
267 if(p->out[1] != -1) { 273 if(p->out[1] != -1) {
268 system_close(p->out[1]); 274 system_close(p->out[1]);
269 } 275 }
270 276
271 return 0; 277 return status;
272 } 278 }
273 279
274 CGIResponseParser* cgi_parser_new(Session *sn, Request *rq) { 280 CGIResponseParser* cgi_parser_new(Session *sn, Request *rq) {
275 CGIResponseParser* parser = pool_malloc(sn->pool, sizeof(CGIResponseParser)); 281 CGIResponseParser* parser = pool_malloc(sn->pool, sizeof(CGIResponseParser));
276 parser->sn = sn; 282 parser->sn = sn;

mercurial