From: Dave Cheney Date: Sun, 18 Nov 2012 19:53:58 +0000 (+1100) Subject: net: fix data race on fd.sysfd X-Git-Tag: go1.1rc2~1842 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c9856e7d2244670a9c8cd8a4e8aa361b7667575d;p=gostls13.git net: fix data race on fd.sysfd Fixes #4369. Remove the check for fd.sysfd < 0, the first line of fd.accept() tests if the fd is open correctly and will handle the fd being closed during accept. R=dvyukov, bradfitz CC=golang-dev https://golang.org/cl/6843076 --- diff --git a/src/pkg/net/tcpsock_posix.go b/src/pkg/net/tcpsock_posix.go index 7b827f1e97..e5b3a09f75 100644 --- a/src/pkg/net/tcpsock_posix.go +++ b/src/pkg/net/tcpsock_posix.go @@ -231,7 +231,7 @@ type TCPListener struct { // AcceptTCP accepts the next incoming call and returns the new connection // and the remote address. func (l *TCPListener) AcceptTCP() (c *TCPConn, err error) { - if l == nil || l.fd == nil || l.fd.sysfd < 0 { + if l == nil || l.fd == nil { return nil, syscall.EINVAL } fd, err := l.fd.accept(sockaddrToTCP)