From: Ruben Kerkhof Date: Wed, 23 May 2018 13:38:26 +0000 (+0200) Subject: netlink plugin: fix build warnings X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=d81c51ba4e71e985ea73dde44fb5a7bf5adbf66a;p=collectd.git netlink plugin: fix build warnings src/netlink.c:546:13: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare] if (r >= sizeof(type_instance)) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~ src/netlink.c:585:13: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare] if (r >= sizeof(type_instance)) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~ --- diff --git a/src/netlink.c b/src/netlink.c index 0bd598cb..a1f52a45 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -543,7 +543,7 @@ static int qos_filter_cb(const struct nlmsghdr *nlh, void *args) { int r = snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, tc_inst); - if (r >= sizeof(type_instance)) { + if ((size_t)r >= sizeof(type_instance)) { ERROR("netlink plugin: type_instance truncated to %zu bytes, need %d", sizeof(type_instance), r); return MNL_CB_ERROR; @@ -582,7 +582,7 @@ static int qos_filter_cb(const struct nlmsghdr *nlh, void *args) { int r = snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, tc_inst); - if (r >= sizeof(type_instance)) { + if ((size_t)r >= sizeof(type_instance)) { ERROR("netlink plugin: type_instance truncated to %zu bytes, need %d", sizeof(type_instance), r); return MNL_CB_ERROR;