net: check Getsockname error return
Reviewed-on: https://go-review.googlesource.com/64550 From-SVN: r253231
This commit is contained in:
parent
b55c7343f0
commit
509b9b7ae0
|
@ -1,4 +1,4 @@
|
|||
e0c1f0b645b12a544b484c0f477f8fb6f5980550
|
||||
cdf1f58c7578980e1d1949680c7e404961b7c153
|
||||
|
||||
The first line of this file holds the git revision number of the last
|
||||
merge done from the gofrontend repository.
|
||||
|
|
|
@ -182,7 +182,10 @@ func (fd *netFD) listenStream(laddr sockaddr, backlog int) error {
|
|||
if err := fd.init(); err != nil {
|
||||
return err
|
||||
}
|
||||
lsa, _ := syscall.Getsockname(fd.pfd.Sysfd)
|
||||
lsa, err := syscall.Getsockname(fd.pfd.Sysfd)
|
||||
if err != nil {
|
||||
return os.NewSyscallError("getsockname", err)
|
||||
}
|
||||
fd.setAddr(fd.addrFunc()(lsa), nil)
|
||||
return nil
|
||||
}
|
||||
|
@ -221,7 +224,10 @@ func (fd *netFD) listenDatagram(laddr sockaddr) error {
|
|||
if err := fd.init(); err != nil {
|
||||
return err
|
||||
}
|
||||
lsa, _ := syscall.Getsockname(fd.pfd.Sysfd)
|
||||
lsa, err := syscall.Getsockname(fd.pfd.Sysfd)
|
||||
if err != nil {
|
||||
return os.NewSyscallError("getsockname", err)
|
||||
}
|
||||
fd.setAddr(fd.addrFunc()(lsa), nil)
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue