src/server/safs/cgi.c

changeset 528
8206bfafb7a6
parent 527
bc6b4f3d92af
child 530
1e117b5d6710
equal deleted inserted replaced
527:bc6b4f3d92af 528:8206bfafb7a6
137 if(w <= 0) { 137 if(w <= 0) {
138 log_ereport( 138 log_ereport(
139 LOG_FAILURE, 139 LOG_FAILURE,
140 "send-cgi: script: %s: cannot send request body to cgi process", 140 "send-cgi: script: %s: cannot send request body to cgi process",
141 path); 141 path);
142 kill(handler->process.pid, SIGKILL); 142 kill(handler->process.pid, SIGTERM);
143 cgi_close(&handler->process); 143 cgi_close(&handler->process);
144 return REQ_ABORTED; 144 return REQ_ABORTED;
145 } 145 }
146 n += r; 146 n += r;
147 } 147 }
569 569
570 handler->debug_finished = TRUE; 570 handler->debug_finished = TRUE;
571 571
572 if(handler->result == REQ_ABORTED && handler->process.pid != 0) { 572 if(handler->result == REQ_ABORTED && handler->process.pid != 0) {
573 log_ereport(LOG_FAILURE, "cgi-send: kill script: %s pid: %d", handler->path, (int)handler->process.pid); 573 log_ereport(LOG_FAILURE, "cgi-send: kill script: %s pid: %d", handler->path, (int)handler->process.pid);
574 if(killpg(handler->process.pid, SIGKILL)) { 574 if(kill(handler->process.pid, SIGTERM)) {
575 log_ereport(LOG_FAILURE, "cgi-send: pid: %d kill failed: %s", (int)handler->process.pid, strerror(errno)); 575 log_ereport(LOG_FAILURE, "cgi-send: pid: %d kill failed: %s", (int)handler->process.pid, strerror(errno));
576 // test: does kill work? 576 } else {
577 if(kill(handler->process.pid, SIGKILL)) { 577 log_ereport(LOG_DEBUG, "cgi-send: finish: req: %p kill %d successful", rq, (int)handler->process.pid);
578 log_ereport(LOG_FAILURE, "cgi-send: pid %d kill2 failed: %s", (int)handler->process.pid, strerror(errno));
579 } else {
580 log_ereport(LOG_DEBUG, "cgi-send: kill(%d, SIGKILL): success", (int)handler->process.pid);
581 }
582 } 578 }
583 } 579 }
584 580
585 if(--handler->events > 0) { 581 if(--handler->events > 0) {
586 return 0; 582 return 0;

mercurial