X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnetlink.c;h=49c4e990fb47d8ea5c15e5c8ae2b8f132c959d1f;hb=8eb9e6285f394569d7fe6ad43a0f4e5f9bca454f;hp=8f45ea2e79334927b3b29942a3f33296bb9f2a6e;hpb=b72d521340383b6418fa6a75faca3bc45f06b14a;p=collectd.git diff --git a/src/netlink.c b/src/netlink.c index 8f45ea2e..49c4e990 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -246,7 +246,7 @@ static int link_filter (const struct sockaddr_nl __attribute__((unused)) *sa, /* Update the `iflist'. It's used to know which interfaces exist and query * them later for qdiscs and classes. */ - if (msg->ifi_index >= iflist_len) + if ((msg->ifi_index >= 0) && ((size_t) msg->ifi_index >= iflist_len)) { char **temp; @@ -359,7 +359,8 @@ static int qos_filter (const struct sockaddr_nl __attribute__((unused)) *sa, return (0); } - if (msg->tcm_ifindex >= iflist_len) + if ((msg->tcm_ifindex >= 0) + && ((size_t) msg->tcm_ifindex >= iflist_len)) { ERROR ("netlink plugin: qos_filter: msg->tcm_ifindex = %i " ">= iflist_len = %zu", @@ -525,9 +526,7 @@ static int ir_config (const char *key, const char *value) } else { - if ((strcasecmp (fields[0], "yes") == 0) - || (strcasecmp (fields[0], "true") == 0) - || (strcasecmp (fields[0], "on") == 0)) + if (IS_TRUE (fields[0])) ir_ignorelist_invert = 0; else ir_ignorelist_invert = 1; @@ -580,9 +579,9 @@ static int ir_read (void) /* `link_filter' will update `iflist' which is used here to iterate over all * interfaces. */ - for (ifindex = 0; ifindex < iflist_len; ifindex++) + for (ifindex = 0; (size_t) ifindex < iflist_len; ifindex++) { - int type_index; + size_t type_index; if (iflist[ifindex] == NULL) continue;