From fdc211dce5d69ca3af2318b30e39173ecf95b2d7 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Sun, 26 Jun 2016 14:37:01 +0200 Subject: [PATCH] ensure unneeded sockets are closed --- hydra-mod.c | 1 + hydra.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hydra-mod.c b/hydra-mod.c index 521660c..30422b3 100644 --- a/hydra-mod.c +++ b/hydra-mod.c @@ -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 } diff --git a/hydra.c b/hydra.c index 625890d..3ab2dd1 100644 --- a/hydra.c +++ b/hydra.c @@ -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]); }