From 2dfd4e7d8c5f5540690dfbbac50aa6f020b2cbbc Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 14 May 2018 12:46:06 +0200 Subject: Cleanup socket file --- uapi_darwin.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'uapi_darwin.go') diff --git a/uapi_darwin.go b/uapi_darwin.go index 0f6d904..a5f2c3b 100644 --- a/uapi_darwin.go +++ b/uapi_darwin.go @@ -57,7 +57,7 @@ func (l *UAPIListener) Close() error { } func (l *UAPIListener) Addr() net.Addr { - return nil + return l.listener.Addr() } func UAPIListen(name string, file *os.File) (net.Listener, error) { @@ -75,6 +75,10 @@ func UAPIListen(name string, file *os.File) (net.Listener, error) { connErr: make(chan error, 1), } + if unixListener, ok := listener.(*net.UnixListener); ok { + unixListener.SetUnlinkOnClose(true) + } + socketPath := path.Join( socketDirectory, fmt.Sprintf(socketName, name), -- cgit v1.2.3-59-g8ed1b