[monitoring-plugins] check_icmp: Cast size_t values for printf(3)
Holger Weiss
git at monitoring-plugins.org
Tue Dec 2 12:00:09 CET 2014
Module: monitoring-plugins
Branch: master
Commit: ed9394880c18a66fa2b60483774cf49064dd3771
Author: Holger Weiss <holger at zedat.fu-berlin.de>
Date: Tue Dec 2 11:36:25 2014 +0100
URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=ed93948
check_icmp: Cast size_t values for printf(3)
Convert size_t values to unsigned long for printf(3) in order to
maximize portability.
---
plugins-root/check_icmp.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index 44c6826..3982def 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -786,7 +786,8 @@ wait_for_reply(int sock, u_int t)
memcpy(&data, icp.icmp_data, sizeof(data));
if (debug > 2)
printf("ICMP echo-reply of len %lu, id %u, seq %u, cksum 0x%X\n",
- sizeof(data), ntohs(icp.icmp_id), ntohs(icp.icmp_seq), icp.icmp_cksum);
+ (unsigned long)sizeof(data), ntohs(icp.icmp_id),
+ ntohs(icp.icmp_seq), icp.icmp_cksum);
host = table[ntohs(icp.icmp_seq)/packets];
tdiff = get_timevaldiff(&data.stime, &now);
@@ -865,7 +866,9 @@ send_icmp_ping(int sock, struct rta_host *host)
if (debug > 2)
printf("Sending ICMP echo-request of len %lu, id %u, seq %u, cksum 0x%X to host %s\n",
- sizeof(data), ntohs(packet.icp->icmp_id), ntohs(packet.icp->icmp_seq), packet.icp->icmp_cksum, host->name);
+ (unsigned long)sizeof(data), ntohs(packet.icp->icmp_id),
+ ntohs(packet.icp->icmp_seq), packet.icp->icmp_cksum,
+ host->name);
memset(&iov, 0, sizeof(iov));
iov.iov_base = packet.buf;
More information about the Commits
mailing list