diff options
author | Ondřej Surý <ondrej@sury.org> | 2012-01-30 15:38:19 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2012-01-30 15:38:19 +0100 |
commit | 4cecda6c347bd6902b960c6a35a967add7070b0d (patch) | |
tree | a462e224ff41ec9f3eb1a0b6e815806f9e8804ad /src/pkg/net/interface_windows.go | |
parent | 6c7ca6e4d4e26e4c8cbe0d183966011b3b088a0a (diff) | |
download | golang-4cecda6c347bd6902b960c6a35a967add7070b0d.tar.gz |
Imported Upstream version 2012.01.27upstream-weekly/2012.01.27
Diffstat (limited to 'src/pkg/net/interface_windows.go')
-rw-r--r-- | src/pkg/net/interface_windows.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/pkg/net/interface_windows.go b/src/pkg/net/interface_windows.go index 7f5169c87..add3dd3b9 100644 --- a/src/pkg/net/interface_windows.go +++ b/src/pkg/net/interface_windows.go @@ -21,7 +21,7 @@ func bytePtrToString(p *uint8) string { return string(a[:i]) } -func getAdapterList() (*syscall.IpAdapterInfo, os.Error) { +func getAdapterList() (*syscall.IpAdapterInfo, error) { b := make([]byte, 1000) l := uint32(len(b)) a := (*syscall.IpAdapterInfo)(unsafe.Pointer(&b[0])) @@ -31,15 +31,15 @@ func getAdapterList() (*syscall.IpAdapterInfo, os.Error) { a = (*syscall.IpAdapterInfo)(unsafe.Pointer(&b[0])) e = syscall.GetAdaptersInfo(a, &l) } - if e != 0 { + if e != nil { return nil, os.NewSyscallError("GetAdaptersInfo", e) } return a, nil } -func getInterfaceList() ([]syscall.InterfaceInfo, os.Error) { +func getInterfaceList() ([]syscall.InterfaceInfo, error) { s, e := syscall.Socket(syscall.AF_INET, syscall.SOCK_DGRAM, syscall.IPPROTO_UDP) - if e != 0 { + if e != nil { return nil, os.NewSyscallError("Socket", e) } defer syscall.Closesocket(s) @@ -48,7 +48,7 @@ func getInterfaceList() ([]syscall.InterfaceInfo, os.Error) { ret := uint32(0) size := uint32(unsafe.Sizeof(ii)) e = syscall.WSAIoctl(s, syscall.SIO_GET_INTERFACE_LIST, nil, 0, (*byte)(unsafe.Pointer(&ii[0])), size, &ret, nil, 0) - if e != 0 { + if e != nil { return nil, os.NewSyscallError("WSAIoctl", e) } c := ret / uint32(unsafe.Sizeof(ii[0])) @@ -58,7 +58,7 @@ func getInterfaceList() ([]syscall.InterfaceInfo, os.Error) { // If the ifindex is zero, interfaceTable returns mappings of all // network interfaces. Otheriwse it returns a mapping of a specific // interface. -func interfaceTable(ifindex int) ([]Interface, os.Error) { +func interfaceTable(ifindex int) ([]Interface, error) { ai, e := getAdapterList() if e != nil { return nil, e @@ -77,7 +77,7 @@ func interfaceTable(ifindex int) ([]Interface, os.Error) { row := syscall.MibIfRow{Index: index} e := syscall.GetIfEntry(&row) - if e != 0 { + if e != nil { return nil, os.NewSyscallError("GetIfEntry", e) } @@ -129,7 +129,7 @@ func interfaceTable(ifindex int) ([]Interface, os.Error) { // If the ifindex is zero, interfaceAddrTable returns addresses // for all network interfaces. Otherwise it returns addresses // for a specific interface. -func interfaceAddrTable(ifindex int) ([]Addr, os.Error) { +func interfaceAddrTable(ifindex int) ([]Addr, error) { ai, e := getAdapterList() if e != nil { return nil, e @@ -153,6 +153,6 @@ func interfaceAddrTable(ifindex int) ([]Addr, os.Error) { // If the ifindex is zero, interfaceMulticastAddrTable returns // addresses for all network interfaces. Otherwise it returns // addresses for a specific interface. -func interfaceMulticastAddrTable(ifindex int) ([]Addr, os.Error) { +func interfaceMulticastAddrTable(ifindex int) ([]Addr, error) { return nil, nil } |