genetlink: Add missing error check

Before this change, error returned by `parseFamilies` was silently
ignored.

Signed-off-by: Michal Rostecki <mrostecki@suse.de>
This commit is contained in:
Michal Rostecki 2018-11-30 17:19:46 +01:00 committed by Flavio Crisciani
parent 91b013f9ed
commit 25298936a6
1 changed files with 3 additions and 0 deletions

View File

@ -157,6 +157,9 @@ func (h *Handle) GenlFamilyGet(name string) (*GenlFamily, error) {
return nil, err return nil, err
} }
families, err := parseFamilies(msgs) families, err := parseFamilies(msgs)
if err != nil {
return nil, err
}
if len(families) != 1 { if len(families) != 1 {
return nil, fmt.Errorf("invalid response for GENL_CTRL_CMD_GETFAMILY") return nil, fmt.Errorf("invalid response for GENL_CTRL_CMD_GETFAMILY")
} }