net/ipsock.go: fix error checking bug

Check oserr, not err for non-nil (err is never changed)

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/1965042
This commit is contained in:
Scott Lawrence 2010-08-22 22:12:56 +10:00 committed by Rob Pike
parent e5518feaf8
commit d125faeed0

View file

@ -68,12 +68,12 @@ func internetSocket(net string, laddr, raddr sockaddr, socktype, proto int, mode
var la, ra syscall.Sockaddr
if laddr != nil {
if la, oserr = laddr.sockaddr(family); err != nil {
if la, oserr = laddr.sockaddr(family); oserr != nil {
goto Error
}
}
if raddr != nil {
if ra, oserr = raddr.sockaddr(family); err != nil {
if ra, oserr = raddr.sockaddr(family); oserr != nil {
goto Error
}
}