diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-02 16:38:43 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-02 16:38:43 +0000 |
commit | 2d2d80b8bd963f59534897b3d51ef8bd546cb4bc (patch) | |
tree | efa0c55763b34cbc633bc494c2743d1b5d9aaff3 /libgo/go/net/sockoptip_linux.go | |
parent | 2ad2700dbf70b2e49575f3f2307839a45cf2f71c (diff) | |
download | gcc-2d2d80b8bd963f59534897b3d51ef8bd546cb4bc.tar.gz |
libgo: Update to weekly.2012-02-14 release.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184798 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/net/sockoptip_linux.go')
-rw-r--r-- | libgo/go/net/sockoptip_linux.go | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/libgo/go/net/sockoptip_linux.go b/libgo/go/net/sockoptip_linux.go index 360f8dea60a..169718f14aa 100644 --- a/libgo/go/net/sockoptip_linux.go +++ b/libgo/go/net/sockoptip_linux.go @@ -12,7 +12,9 @@ import ( ) func ipv4MulticastInterface(fd *netFD) (*Interface, error) { - fd.incref() + if err := fd.incref(false); err != nil { + return nil, err + } defer fd.decref() mreq, err := syscall.GetsockoptIPMreqn(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_IF) if err != nil { @@ -30,7 +32,9 @@ func setIPv4MulticastInterface(fd *netFD, ifi *Interface) error { v = int32(ifi.Index) } mreq := &syscall.IPMreqn{Ifindex: v} - fd.incref() + if err := fd.incref(false); err != nil { + return err + } defer fd.decref() err := syscall.SetsockoptIPMreqn(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_IF, mreq) if err != nil { @@ -40,7 +44,9 @@ func setIPv4MulticastInterface(fd *netFD, ifi *Interface) error { } func ipv4MulticastTTL(fd *netFD) (int, error) { - fd.incref() + if err := fd.incref(false); err != nil { + return 0, err + } defer fd.decref() v, err := syscall.GetsockoptInt(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_TTL) if err != nil { @@ -50,7 +56,9 @@ func ipv4MulticastTTL(fd *netFD) (int, error) { } func setIPv4MulticastTTL(fd *netFD, v int) error { - fd.incref() + if err := fd.incref(false); err != nil { + return err + } defer fd.decref() err := syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_TTL, v) if err != nil { @@ -60,7 +68,9 @@ func setIPv4MulticastTTL(fd *netFD, v int) error { } func ipv4MulticastLoopback(fd *netFD) (bool, error) { - fd.incref() + if err := fd.incref(false); err != nil { + return false, err + } defer fd.decref() v, err := syscall.GetsockoptInt(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_LOOP) if err != nil { @@ -70,7 +80,9 @@ func ipv4MulticastLoopback(fd *netFD) (bool, error) { } func setIPv4MulticastLoopback(fd *netFD, v bool) error { - fd.incref() + if err := fd.incref(false); err != nil { + return err + } defer fd.decref() err := syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_LOOP, boolint(v)) if err != nil { @@ -80,7 +92,9 @@ func setIPv4MulticastLoopback(fd *netFD, v bool) error { } func ipv4ReceiveInterface(fd *netFD) (bool, error) { - fd.incref() + if err := fd.incref(false); err != nil { + return false, err + } defer fd.decref() v, err := syscall.GetsockoptInt(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_PKTINFO) if err != nil { @@ -90,7 +104,9 @@ func ipv4ReceiveInterface(fd *netFD) (bool, error) { } func setIPv4ReceiveInterface(fd *netFD, v bool) error { - fd.incref() + if err := fd.incref(false); err != nil { + return err + } defer fd.decref() err := syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_PKTINFO, boolint(v)) if err != nil { @@ -100,17 +116,21 @@ func setIPv4ReceiveInterface(fd *netFD, v bool) error { } func ipv6TrafficClass(fd *netFD) (int, error) { - fd.incref() + if err := fd.incref(false); err != nil { + return 0, err + } defer fd.decref() v, err := syscall.GetsockoptInt(fd.sysfd, syscall.IPPROTO_IPV6, syscall.IPV6_TCLASS) if err != nil { - return -1, os.NewSyscallError("getsockopt", err) + return 0, os.NewSyscallError("getsockopt", err) } return v, nil } func setIPv6TrafficClass(fd *netFD, v int) error { - fd.incref() + if err := fd.incref(false); err != nil { + return err + } defer fd.decref() err := syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_IPV6, syscall.IPV6_TCLASS, v) if err != nil { |