summaryrefslogtreecommitdiffhomepage
path: root/uapi_linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'uapi_linux.go')
-rw-r--r--uapi_linux.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/uapi_linux.go b/uapi_linux.go
index 67024e9..45be0f5 100644
--- a/uapi_linux.go
+++ b/uapi_linux.go
@@ -46,8 +46,8 @@ func (l *UAPIListener) Accept() (net.Conn, error) {
func (l *UAPIListener) Close() error {
err1 := unix.Close(l.inotifyFd)
- err2 := l.listener.Close()
- err3 := l.inotifyRWCancel.Cancel()
+ err2 := l.inotifyRWCancel.Cancel()
+ err3 := l.listener.Close()
if err1 != nil {
return err1
}
@@ -58,7 +58,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) {
@@ -70,6 +70,10 @@ func UAPIListen(name string, file *os.File) (net.Listener, error) {
return nil, err
}
+ if unixListener, ok := listener.(*net.UnixListener); ok {
+ unixListener.SetUnlinkOnClose(true)
+ }
+
uapi := &UAPIListener{
listener: listener,
connNew: make(chan net.Conn, 1),