1
0
mirror of https://github.com/golang/go synced 2024-11-21 23:44:39 -07:00

net: fix /proc/net/igmp,igmp6 reading bug on linux

Fixes #2130.

R=rsc, dave
CC=golang-dev
https://golang.org/cl/4846044
This commit is contained in:
Mikio Hara 2011-08-05 09:20:13 +10:00 committed by David Symonds
parent 5b1f159fb5
commit ba9833269d

View File

@ -192,8 +192,6 @@ func interfaceMulticastAddrTable(ifindex int) ([]Addr, os.Error) {
var (
ifi *Interface
err os.Error
ifmat4 []Addr
ifmat6 []Addr
)
if ifindex > 0 {
@ -203,20 +201,13 @@ func interfaceMulticastAddrTable(ifindex int) ([]Addr, os.Error) {
}
}
ifmat4, err = parseProcNetIGMP(ifi)
if err != nil {
return nil, err
}
ifmat6, err = parseProcNetIGMP6(ifi)
if err != nil {
return nil, err
}
ifmat4 := parseProcNetIGMP(ifi)
ifmat6 := parseProcNetIGMP6(ifi)
return append(ifmat4, ifmat6...), nil
}
func parseProcNetIGMP(ifi *Interface) ([]Addr, os.Error) {
func parseProcNetIGMP(ifi *Interface) []Addr {
var (
ifmat []Addr
name string
@ -224,7 +215,7 @@ func parseProcNetIGMP(ifi *Interface) ([]Addr, os.Error) {
fd, err := open("/proc/net/igmp")
if err != nil {
return nil, err
return nil
}
defer fd.close()
@ -244,15 +235,15 @@ func parseProcNetIGMP(ifi *Interface) ([]Addr, os.Error) {
}
}
return ifmat, nil
return ifmat
}
func parseProcNetIGMP6(ifi *Interface) ([]Addr, os.Error) {
func parseProcNetIGMP6(ifi *Interface) []Addr {
var ifmat []Addr
fd, err := open("/proc/net/igmp6")
if err != nil {
return nil, err
return nil
}
defer fd.close()
@ -267,5 +258,5 @@ func parseProcNetIGMP6(ifi *Interface) ([]Addr, os.Error) {
}
}
return ifmat, nil
return ifmat
}