From: Sami Kerola Date: Wed, 17 Aug 2016 21:51:44 +0000 (+0100) Subject: warnings: fix --disable-ipv6 --without-ipinfo compilation warnings X-Git-Tag: v0.88~36^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F138%2Fhead;p=thirdparty%2Fmtr.git warnings: fix --disable-ipv6 --without-ipinfo compilation warnings Add include to avoid implicit declaration of built-in functions, replace bzero() with memset(), mark function argument unused, and use %zu to print size_t data type. Signed-off-by: Sami Kerola --- diff --git a/dns.c b/dns.c index f3a4df9..69df14c 100644 --- a/dns.c +++ b/dns.c @@ -49,7 +49,7 @@ #include #include //#include -//#include +#include #include #include #include @@ -86,7 +86,11 @@ char *strlongip(ip_t * ip) } -int longipstr( char *s, ip_t *dst, int family ) +int longipstr( char *s, ip_t *dst, int family +#ifndef ENABLE_IPV6 +UNUSED +#endif +) { #ifdef ENABLE_IPV6 return inet_pton( family, s, dst ); @@ -126,7 +130,7 @@ void set_sockaddr_ip (struct sockaddr_storage *sa, ip_t *ip) struct sockaddr_in *sa_in; struct sockaddr_in6 *sa_in6; - bzero (sa, sizeof (struct sockaddr_storage)); + memset (sa, 0, sizeof (struct sockaddr_storage)); switch (af) { case AF_INET: sa_in = (struct sockaddr_in *) sa; diff --git a/report.c b/report.c index 67bf27c..e15e38d 100644 --- a/report.c +++ b/report.c @@ -119,7 +119,7 @@ void report_close(void) } snprintf( fmt, sizeof(fmt), "HOST: %%-%ds", len_tmp); #else - snprintf( fmt, sizeof(fmt), "HOST: %%-%ds", len_hosts); + snprintf( fmt, sizeof(fmt), "HOST: %%-%zus", len_hosts); #endif snprintf(buf, sizeof(buf), fmt, LocalHostname); len = reportwide ? strlen(buf) : len_hosts;