summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ra.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ra.c b/src/ra.c
index aa03ff4..971a172 100644
--- a/src/ra.c
+++ b/src/ra.c
@@ -161,7 +161,8 @@ bool ra_link_up(void)
do {
read = recv(rtnl, &resp, sizeof(resp), MSG_DONTWAIT);
- if (!NLMSG_OK(&resp.hdr, read) || resp.hdr.nlmsg_type != RTM_NEWLINK ||
+ if (read < 0 || !NLMSG_OK(&resp.hdr, (size_t)read) ||
+ resp.hdr.nlmsg_type != RTM_NEWLINK ||
resp.msg.ifi_index != if_index)
continue;