summaryrefslogtreecommitdiff
path: root/libgo/go/net/sock.go
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-08 10:11:09 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-08 10:11:09 +0000
commit6195c0dd4e15f50ac89491b48e050751f8231304 (patch)
tree1f49de2cfcd902f18c22b5539315d7b0fb4db972 /libgo/go/net/sock.go
parentd7ce7f9586bca838e0dcc7e39100ffe6edcd74f3 (diff)
downloadgcc-6195c0dd4e15f50ac89491b48e050751f8231304.tar.gz
2012-03-08 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk [future 4.8] rev 185094 using svnmerge 2011-03-08 Basile Starynkevitch <basile@starynkevitch.net> [gcc/] * melt-build.tpl (meltframe.args): Add -Iinclude-fixed if it exists. * melt-build.mk: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@185096 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/net/sock.go')
-rw-r--r--libgo/go/net/sock.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/libgo/go/net/sock.go b/libgo/go/net/sock.go
index 70064c307ef..dc139f04a25 100644
--- a/libgo/go/net/sock.go
+++ b/libgo/go/net/sock.go
@@ -33,13 +33,14 @@ func socket(net string, f, t, p int, la, ra syscall.Sockaddr, toAddr func(syscal
return nil, err
}
+ var bla syscall.Sockaddr
if la != nil {
- la, err = listenerSockaddr(s, f, la, toAddr)
+ bla, err = listenerSockaddr(s, f, la, toAddr)
if err != nil {
closesocket(s)
return nil, err
}
- err = syscall.Bind(s, la)
+ err = syscall.Bind(s, bla)
if err != nil {
closesocket(s)
return nil, err
@@ -61,7 +62,12 @@ func socket(net string, f, t, p int, la, ra syscall.Sockaddr, toAddr func(syscal
}
sa, _ := syscall.Getsockname(s)
- laddr := toAddr(sa)
+ var laddr Addr
+ if la != nil && bla != la {
+ laddr = toAddr(la)
+ } else {
+ laddr = toAddr(sa)
+ }
sa, _ = syscall.Getpeername(s)
raddr := toAddr(sa)