mirror of https://github.com/golang/go.git
net: fix Close of autobind unix listener
Fixes #6455. R=mikioh.mikioh, rsc CC=golang-dev https://golang.org/cl/13457058
This commit is contained in:
parent
2d2ae53119
commit
2be62360b2
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue