runtime/network: Correct error reporting in listInterfaces()

If the upcast from resultingInterfaces to *grpc.Interfaces fails, we
return (nil, err), but previous code ensures that err is nil at that
point, so we return no error.

Forward port of
b86e904c2d

fixes #1206

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2020-10-29 14:34:52 +11:00
parent 1b2ccf87f8
commit 1ae8e81abb

View File

@ -635,10 +635,10 @@ func (k *kataAgent) listInterfaces() ([]*pbTypes.Interface, error) {
return nil, err
}
resultInterfaces, ok := resultingInterfaces.(*grpc.Interfaces)
if ok {
return resultInterfaces.Interfaces, err
if !ok {
return nil, fmt.Errorf("Unexpected type %T for interfaces", resultingInterfaces)
}
return nil, err
return resultInterfaces.Interfaces, nil
}
func (k *kataAgent) listRoutes() ([]*pbTypes.Route, error) {