From: Ian Lance Taylor Date: Wed, 27 Sep 2017 14:22:36 +0000 (+0000) Subject: net: check Getsockname error return X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=509b9b7ae0d81a69030991136d430ac593d7a92b;p=gcc.git net: check Getsockname error return Reviewed-on: https://go-review.googlesource.com/64550 From-SVN: r253231 --- diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index dcab046c82e..de1369dedac 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -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. diff --git a/libgo/go/net/sock_posix.go b/libgo/go/net/sock_posix.go index a30efe2336a..4733c422f16 100644 --- a/libgo/go/net/sock_posix.go +++ b/libgo/go/net/sock_posix.go @@ -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 }