[PATCH 3/3] attr: fix compile warning in headers
Peter Wu
peter at lekensteyn.nl
Tue Jun 24 14:13:38 PDT 2014
strlen() returns a size_t type, but nla_put accepts an int only. This
breaks a -Werror build of applications using libnl, so avoid this
warning by explicitly casting the length to an int.
Signed-off-by: Peter Wu <peter at lekensteyn.nl>
---
include/netlink/attr.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/netlink/attr.h b/include/netlink/attr.h
index 0ed3da3..82e4c38 100644
--- a/include/netlink/attr.h
+++ b/include/netlink/attr.h
@@ -205,7 +205,7 @@ extern int nla_is_nested(struct nlattr *);
* @arg value NUL terminated character string.
*/
#define NLA_PUT_STRING(msg, attrtype, value) \
- NLA_PUT(msg, attrtype, strlen(value) + 1, value)
+ NLA_PUT(msg, attrtype, (int) strlen(value) + 1, value)
/**
* Add flag attribute to netlink message.
--
2.0.0
More information about the libnl
mailing list