diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-07-16 06:54:42 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-07-16 06:54:42 +0000 |
commit | be47d6eceffd2c5dbbc1566d5eea490527fb2bd4 (patch) | |
tree | 0e8fda573576bb4181dba29d0e88380a8c38fafd /libgo/go/syscall/socket.go | |
parent | efb30cdeb003fd7c585ee0d7657340086abcbd9e (diff) | |
download | gcc-be47d6eceffd2c5dbbc1566d5eea490527fb2bd4.zip gcc-be47d6eceffd2c5dbbc1566d5eea490527fb2bd4.tar.gz gcc-be47d6eceffd2c5dbbc1566d5eea490527fb2bd4.tar.bz2 |
libgo: Update to Go 1.1.1.
From-SVN: r200974
Diffstat (limited to 'libgo/go/syscall/socket.go')
-rw-r--r-- | libgo/go/syscall/socket.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libgo/go/syscall/socket.go b/libgo/go/syscall/socket.go index a625eb6..cf0c08e 100644 --- a/libgo/go/syscall/socket.go +++ b/libgo/go/syscall/socket.go @@ -79,7 +79,7 @@ type SockaddrUnix struct { func (sa *SockaddrUnix) sockaddr() (*RawSockaddrAny, Socklen_t, error) { name := sa.Name n := len(name) - if n >= len(sa.raw.Path) || n == 0 { + if n >= len(sa.raw.Path) { return nil, 0, EINVAL } sa.raw.Family = AF_UNIX @@ -88,7 +88,10 @@ func (sa *SockaddrUnix) sockaddr() (*RawSockaddrAny, Socklen_t, error) { sa.raw.Path[i] = int8(name[i]) } // length is family (uint16), name, NUL. - sl := 2 + Socklen_t(n) + 1 + sl := Socklen_t(2) + if n > 0 { + sl += Socklen_t(n) + 1 + } if sa.raw.Path[0] == '@' { sa.raw.Path[0] = 0 // Don't count trailing NUL for abstract address. @@ -307,7 +310,9 @@ func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) { if n, err = recvfrom(fd, p, flags, &rsa, &len); err != nil { return } - from, err = anyToSockaddr(&rsa) + if rsa.Addr.Family != AF_UNSPEC { + from, err = anyToSockaddr(&rsa) + } return } |