From 4afd6ef9b1eeab843b5c1de2cfabb1f22baf994c Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Sun, 4 Feb 2024 01:28:43 +0100 Subject: [PATCH] Make ssh sockets close on exit --- agent/ssh/sshsocketunix.go | 1 + agent/unixsocketagent.go | 1 + 2 files changed, 2 insertions(+) diff --git a/agent/ssh/sshsocketunix.go b/agent/ssh/sshsocketunix.go index bce588d..d745a86 100644 --- a/agent/ssh/sshsocketunix.go +++ b/agent/ssh/sshsocketunix.go @@ -22,6 +22,7 @@ func (v SSHAgentServer) Serve() { if err != nil { panic(err) } + defer listener.Close() log.Info("SSH Agent listening on %s", path) diff --git a/agent/unixsocketagent.go b/agent/unixsocketagent.go index c44adeb..101007d 100644 --- a/agent/unixsocketagent.go +++ b/agent/unixsocketagent.go @@ -294,6 +294,7 @@ func StartUnixAgent(path string, runtimeConfig config.RuntimeConfig) error { println("listen error", err.Error()) return err } + defer l.Close() log.Info("Agent listening on %s...", path) go func() {