mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-28 19:44:21 +01:00
cli: syscall return value check is wrong
ret is uintptr and always >= 0. errno is enough for error checking.
This is causing lint error:
/home/vagrant/workplace/golang/src/github.com/kata-containers/runtime/virtcontainers/utils
cli/kata-check.go:446:20: SA4003: no value of type uintptr is less than 0 (staticcheck)
if errno != 0 || ret <= 0 {
^
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
@@ -443,7 +443,7 @@ func genericCheckKVMExtensions(extensions map[string]kvmExtension) (map[string]i
|
|||||||
|
|
||||||
// Generally return value(ret) 0 means no and 1 means yes,
|
// Generally return value(ret) 0 means no and 1 means yes,
|
||||||
// but some extensions may report additional information in the integer return value.
|
// but some extensions may report additional information in the integer return value.
|
||||||
if errno != 0 || ret <= 0 {
|
if errno != 0 {
|
||||||
kataLog.WithFields(fields).Error("is not supported")
|
kataLog.WithFields(fields).Error("is not supported")
|
||||||
return results, errno
|
return results, errno
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user