X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnetlink.c;h=a3b40d492dc32e696bf21ae97d61b61dd815dea7;hb=8f6aa6970bf787e6a11e095322af3338ec781d78;hp=0bd598cbbf29f96d83980df1f31b6982fc202a40;hpb=a3dd3831138a4167ceb8782a63ef123832e8bfba;p=collectd.git diff --git a/src/netlink.c b/src/netlink.c index 0bd598cb..a3b40d49 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -27,8 +27,8 @@ #include "collectd.h" -#include "common.h" #include "plugin.h" +#include "utils/common/common.h" #include @@ -509,7 +509,7 @@ static int qos_filter_cb(const struct nlmsghdr *nlh, void *args) { if (strcmp(tc_type, "filter") == 0) numberic_id = tm->tcm_parent; - snprintf(tc_inst, sizeof(tc_inst), "%s-%x:%x", kind, numberic_id >> 16, + ssnprintf(tc_inst, sizeof(tc_inst), "%s-%x:%x", kind, numberic_id >> 16, numberic_id & 0x0000FFFF); } @@ -541,9 +541,9 @@ static int qos_filter_cb(const struct nlmsghdr *nlh, void *args) { stats_submitted = true; - int r = snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, + int r = ssnprintf(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; @@ -580,9 +580,9 @@ static int qos_filter_cb(const struct nlmsghdr *nlh, void *args) { if (!stats_submitted && ts != NULL) { char type_instance[DATA_MAX_NAME_LEN]; - int r = snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, + int r = ssnprintf(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;