When nl_send_auto_complete() fails, an explicit error must be set or
otherwise query_rtnl_link() will return 0 (no error).
Fixes: 60e519bfeaa3 ("batctl: Use rtnl to query list of softif devices")
Signed-off-by: Sven Eckelmann <[email protected]>
---
functions.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/functions.c b/functions.c
index 56bacdf..213ba83 100644
--- a/functions.c
+++ b/functions.c
@@ -493,8 +493,10 @@ int query_rtnl_link(int ifindex, nl_recvmsg_msg_cb_t func,
void *arg)
}
ret = nl_send_auto_complete(sock, msg);
- if (ret < 0)
+ if (ret < 0) {
+ err = -EIO;
goto err_free_msg;
+ }
ret = nl_recvmsgs(sock, cb);
if (ret < 0)
--
2.47.3