os/errno:fix os.Errno 's nil pointer derefer in linux

This commit is contained in:
luoliwoshang
2024-10-12 11:58:53 +08:00
parent 9ea88fe247
commit e9177c8932
10 changed files with 54 additions and 22 deletions

View File

@@ -466,7 +466,7 @@ func SysctlUint32(name string) (value uint32, err error) {
n := uintptr(4)
ret := os.Sysctlbyname(c.AllocaCStr(name), unsafe.Pointer(&value), &n, nil, 0)
if ret != 0 {
err = Errno(os.Errno)
err = Errno(os.Errno())
}
return
}