]> Cypherpunks repositories - gostls13.git/commitdiff
net: fix data race on fd.sysfd
authorDave Cheney <dave@cheney.net>
Sun, 18 Nov 2012 19:53:58 +0000 (06:53 +1100)
committerDave Cheney <dave@cheney.net>
Sun, 18 Nov 2012 19:53:58 +0000 (06:53 +1100)
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

src/pkg/net/tcpsock_posix.go

index 7b827f1e97133d6d4b17702d170e0e9cd328d727..e5b3a09f75c257eba7f46f6e7346d3562c375c68 100644 (file)
@@ -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)