ensure unneeded sockets are closed

This commit is contained in:
van Hauser 2016-06-26 14:37:01 +02:00
commit fdc211dce5
2 changed files with 2 additions and 1 deletions

View file

@ -605,6 +605,7 @@ void hydra_child_exit(int code) {
do {
sleepn(10);
} while (read(intern_socket, buf, 1) <= 0);
close(intern_socket);
// sleep(2); // be sure that mommy receives our message
exit(0); // might be killed before reaching this
}

View file

@ -1560,7 +1560,7 @@ void hydra_kill_head(int head_no, int killit, int fail) {
printf("[DEBUG] head_no %d, kill %d, fail %d\n", head_no, killit, fail);
if (head_no < 0)
return;
if (hydra_heads[head_no]->active > 0) {
if (hydra_heads[head_no]->active > 0 || (hydra_heads[head_no]->sp[0] > 2 && hydra_heads[head_no]->sp[1] > 2)) {
close(hydra_heads[head_no]->sp[0]);
close(hydra_heads[head_no]->sp[1]);
}