Commit 2be62360 authored by Albert Strasheim's avatar Albert Strasheim Committed by Russ Cox

net: fix Close of autobind unix listener

Fixes #6455.

R=mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/13457058
parent 2d2ae531
......@@ -107,7 +107,7 @@ func TestReadUnixgramWithZeroBytesBuffer(t *testing.T) {
}
}
func TestUnixAutobind(t *testing.T) {
func TestUnixgramAutobind(t *testing.T) {
if runtime.GOOS != "linux" {
t.Skip("skipping: autobind is linux only")
}
......@@ -139,6 +139,18 @@ func TestUnixAutobind(t *testing.T) {
}
}
func TestUnixAutobindClose(t *testing.T) {
if runtime.GOOS != "linux" {
t.Skip("skipping: autobind is linux only")
}
laddr := &UnixAddr{Name: "", Net: "unix"}
ln, err := ListenUnix("unix", laddr)
if err != nil {
t.Fatalf("ListenUnix failed: %v", err)
}
ln.Close()
}
func TestUnixConnLocalAndRemoteNames(t *testing.T) {
for _, laddr := range []string{"", testUnixAddr()} {
laddr := laddr
......
......@@ -271,7 +271,7 @@ func ListenUnix(net string, laddr *UnixAddr) (*UnixListener, error) {
if err != nil {
return nil, &OpError{Op: "listen", Net: net, Addr: laddr, Err: err}
}
return &UnixListener{fd, laddr.Name}, nil
return &UnixListener{fd, fd.laddr.String()}, nil
}
// AcceptUnix accepts the next incoming call and returns the new
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment