Skip to content

Commit 361ab73

Browse files
acln0ianlancetaylor
authored andcommitted
net: close correct file descriptor when netpoll registration fails
In (*netFD).accept, if initializing the *netFD associated with the new connection fails, the listen FD is closed, rather than the FD associated with the new connection. Close the correct FD instead. Fixes #34392 Change-Id: I7bf3469d661e6d30cbd4b12f5f5fd330a81a541b Reviewed-on: https://go-review.googlesource.com/c/go/+/196778 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 20f0bcb commit 361ab73

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/net/fd_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ func (fd *netFD) accept() (netfd *netFD, err error) {
248248
return nil, err
249249
}
250250
if err = netfd.init(); err != nil {
251-
fd.Close()
251+
netfd.Close()
252252
return nil, err
253253
}
254254
lsa, _ := syscall.Getsockname(netfd.pfd.Sysfd)

0 commit comments

Comments
 (0)