From f3c9335402d5853f98645ca28080600bf565f1ce Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Fri, 7 Jul 2017 16:00:48 +0200 Subject: [PATCH] snmp_agent: fix format specifiers MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit make all-am make[1]: Entering directory '/home/ruben/src/collectd' CC src/snmp_agent_la-snmp_agent.lo In file included from ./src/daemon/common.h:33:0, from src/snmp_agent.c:31: src/snmp_agent.c: In function ‘snmp_agent_dump_data’: src/snmp_agent.c:42:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t {aka long unsigned int}’ [-Wformat=] #define PLUGIN_NAME "snmp_agent" ^ ./src/daemon/plugin.h:400:42: note: in definition of macro ‘DEBUG’ #define DEBUG(...) plugin_log(LOG_DEBUG, __VA_ARGS__) ^~~~~~~~~~~ src/snmp_agent.c:192:13: note: in expansion of macro ‘PLUGIN_NAME’ DEBUG(PLUGIN_NAME ": OID[%d]: %s", i, oid_str); ^~~~~~~~~~~ src/snmp_agent.c:192:35: note: format string is defined here DEBUG(PLUGIN_NAME ": OID[%d]: %s", i, oid_str); ~^ %ld CCLD snmp_agent.la --- src/snmp_agent.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/snmp_agent.c b/src/snmp_agent.c index d7aea2d2..0908b4eb 100644 --- a/src/snmp_agent.c +++ b/src/snmp_agent.c @@ -165,7 +165,7 @@ static void snmp_agent_dump_data(void) { DEBUG(PLUGIN_NAME ": TypeInstance: %s", dd->type_instance); for (size_t i = 0; i < dd->oids_len; i++) { snmp_agent_oid_to_string(oid_str, sizeof(oid_str), &dd->oids[i]); - DEBUG(PLUGIN_NAME ": OID[%d]: %s", i, oid_str); + DEBUG(PLUGIN_NAME ": OID[%zu]: %s", i, oid_str); } DEBUG(PLUGIN_NAME ": Scale: %g", dd->scale); DEBUG(PLUGIN_NAME ": Shift: %g", dd->shift); @@ -189,7 +189,7 @@ static void snmp_agent_dump_data(void) { DEBUG(PLUGIN_NAME ": TypeInstance: %s", dd->type_instance); for (size_t i = 0; i < dd->oids_len; i++) { snmp_agent_oid_to_string(oid_str, sizeof(oid_str), &dd->oids[i]); - DEBUG(PLUGIN_NAME ": OID[%d]: %s", i, oid_str); + DEBUG(PLUGIN_NAME ": OID[%zu]: %s", i, oid_str); } DEBUG(PLUGIN_NAME ": Scale: %g", dd->scale); DEBUG(PLUGIN_NAME ": Shift: %g", dd->shift); -- 2.30.2