In case of error the message will be always truncated.
We check the message was truncated with the total size
received which means the kernel as more info to give.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
if (!ret)
return 0;
- if (msg.msg_flags & MSG_TRUNC)
+ if (msg.msg_flags & MSG_TRUNC &&
+ ret == answer->nlmsghdr.nlmsg_len)
return -EMSGSIZE;
return ret;
nladdr.nl_groups = 0;
ret = sendmsg(handler->fd, &msg, 0);
- if (ret < 0) {
+ if (ret < 0)
return -errno;
- }
return ret;
}
struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(answer);
return err->error;
}
-
+
return 0;
}