Cosmetic cleanups.

This commit is contained in:
Nicholas J. Kain 2014-03-17 22:58:55 -04:00
parent 128dbfba21
commit 0e12b4620b

View File

@ -54,15 +54,12 @@ int rtattr_assign(struct rtattr *attr, int type, void *data)
int nl_add_rtattr(struct nlmsghdr *n, size_t max_length, int type, int nl_add_rtattr(struct nlmsghdr *n, size_t max_length, int type,
const void *data, size_t data_length) const void *data, size_t data_length)
{ {
size_t length; size_t length = RTA_LENGTH(data_length);
struct rtattr *rta;
length = RTA_LENGTH(data_length);
if (NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(length) > max_length) if (NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(length) > max_length)
return -E2BIG; return -E2BIG;
rta = NLMSG_TAIL(n); struct rtattr *rta = NLMSG_TAIL(n);
rta->rta_type = type; rta->rta_type = type;
rta->rta_len = length; rta->rta_len = length;
memcpy(RTA_DATA(rta), data, data_length); memcpy(RTA_DATA(rta), data, data_length);