mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-02 23:27:31 -04:00
go.sys/unix: use syscall.Errno for errors
If we use a local type, it won't compare properly with errors from the rest of the standard library. Errors are the one type from syscall that propagates through the system, so it's important to have only one type for them. Ditto for syscall.Signal. LGTM=dave R=rsc, dave CC=golang-codereviews https://golang.org/cl/123490043
This commit is contained in:
+3
-2
@@ -7,6 +7,7 @@
|
||||
package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
@@ -51,7 +52,7 @@ func SetLsfPromisc(name string, m bool) error {
|
||||
copy(ifl.name[:], []byte(name))
|
||||
_, _, ep := Syscall(SYS_IOCTL, uintptr(s), SIOCGIFFLAGS, uintptr(unsafe.Pointer(&ifl)))
|
||||
if ep != 0 {
|
||||
return Errno(ep)
|
||||
return syscall.Errno(ep)
|
||||
}
|
||||
if m {
|
||||
ifl.flags |= uint16(IFF_PROMISC)
|
||||
@@ -60,7 +61,7 @@ func SetLsfPromisc(name string, m bool) error {
|
||||
}
|
||||
_, _, ep = Syscall(SYS_IOCTL, uintptr(s), SIOCSIFFLAGS, uintptr(unsafe.Pointer(&ifl)))
|
||||
if ep != 0 {
|
||||
return Errno(ep)
|
||||
return syscall.Errno(ep)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user