]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
warnings: fix --disable-ipv6 --without-ipinfo compilation warnings 138/head
authorSami Kerola <kerolasa@iki.fi>
Wed, 17 Aug 2016 21:51:44 +0000 (22:51 +0100)
committerSami Kerola <kerolasa@iki.fi>
Wed, 17 Aug 2016 21:55:16 +0000 (22:55 +0100)
Add include <strings.h> 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 <kerolasa@iki.fi>
dns.c
report.c

diff --git a/dns.c b/dns.c
index f3a4df9cd30c4afb538175fa64bf5590a2fde911..69df14cb731ba44c4b19127e68f5b6ff53cc6396 100644 (file)
--- a/dns.c
+++ b/dns.c
@@ -49,7 +49,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 //#include <ctype.h>
-//#include <string.h>
+#include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <signal.h>
@@ -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;
index 67bf27c670a2411d999d5115116f84a3b9408289..e15e38d2eee57312887f62ecfe9a1f25a1c31413 100644 (file)
--- 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;