From 71ce82815ceb307c64692a6784e7e893ba0a776e Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 17 Sep 2013 00:35:45 -0400 Subject: [PATCH] sslh-fork: close all listening sockets in shoveler When we're watching multiple sockets, we don't want to just close the active one we got a connection on before launching the shoveler. If we want to restart the daemon, we run into problems because the socket is still in use. Instead, close all the sockets we were listening on. Signed-off-by: Mike Frysinger --- sslh-fork.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sslh-fork.c b/sslh-fork.c index f42fec6..a6d286e 100644 --- a/sslh-fork.c +++ b/sslh-fork.c @@ -157,7 +157,8 @@ void main_loop(int listen_sockets[], int num_addr_listen) if (!fork()) { - close(listen_sockets[i]); + for (i = 0; i < num_addr_listen; ++i) + close(listen_sockets[i]); start_shoveler(in_socket); exit(0); }