diff options
author | uqs <uqs@FreeBSD.org> | 2010-12-04 14:19:35 +0000 |
---|---|---|
committer | uqs <uqs@FreeBSD.org> | 2010-12-04 14:19:35 +0000 |
commit | 0114bdf52f64f9eaf589d9f88706c9519479deab (patch) | |
tree | 3f537cd44d5729626e01446af81a59e8a26f62cd /usr.sbin/traceroute6/traceroute6.c | |
parent | 1651f4683006c28c940e31292274f20ff6fafc35 (diff) | |
download | FreeBSD-src-0114bdf52f64f9eaf589d9f88706c9519479deab.zip FreeBSD-src-0114bdf52f64f9eaf589d9f88706c9519479deab.tar.gz |
traceroute6(8): make WARNS=3 clean
Diffstat (limited to 'usr.sbin/traceroute6/traceroute6.c')
-rw-r--r-- | usr.sbin/traceroute6/traceroute6.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c index 699af68..1a67173 100644 --- a/usr.sbin/traceroute6/traceroute6.c +++ b/usr.sbin/traceroute6/traceroute6.c @@ -66,7 +66,7 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1990, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ @@ -322,7 +322,7 @@ void send_probe(int, u_long); void *get_uphdr(struct ip6_hdr *, u_char *); int get_hoplim(struct msghdr *); double deltaT(struct timeval *, struct timeval *); -char *pr_type(int); +const char *pr_type(int); int packet_ok(struct msghdr *, int, int); void print(struct msghdr *, int); const char *inetname(struct sockaddr *); @@ -372,12 +372,12 @@ main(argc, argv) { int mib[4] = { CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_DEFHLIM }; char hbuf[NI_MAXHOST], src0[NI_MAXHOST], *ep; - int ch, i, on = 1, seq, rcvcmsglen, error, minlen; + int ch, i, on = 1, seq, rcvcmsglen, error; struct addrinfo hints, *res; static u_char *rcvcmsgbuf; u_long probe, hops, lport; struct hostent *hp; - size_t size; + size_t size, minlen; uid_t uid; /* @@ -671,11 +671,11 @@ main(argc, argv) datalen = minlen; else if (datalen >= MAXPACKET) { fprintf(stderr, - "traceroute6: packet size must be %d <= s < %ld.\n", - minlen, (long)MAXPACKET); + "traceroute6: packet size must be %zu <= s < %d.\n", + minlen, MAXPACKET); exit(1); } - outpacket = (struct opacket *)malloc((unsigned)datalen); + outpacket = malloc(datalen); if (!outpacket) { perror("malloc"); exit(1); @@ -913,7 +913,7 @@ main(argc, argv) for (hops = first_hop; hops <= max_hops; ++hops) { struct in6_addr lastaddr; int got_there = 0; - int unreachable = 0; + unsigned unreachable = 0; printf("%2lu ", hops); bzero(&lastaddr, sizeof(lastaddr)); @@ -1089,7 +1089,7 @@ send_probe(seq, hops) i = sendto(sndsock, (char *)outpacket, datalen, 0, (struct sockaddr *)&Dst, Dst.sin6_len); - if (i < 0 || i != datalen) { + if (i < 0 || (u_long)i != datalen) { if (i < 0) perror("sendto"); printf("traceroute6: wrote %s %lu chars, ret=%d\n", @@ -1129,12 +1129,11 @@ deltaT(t1p, t2p) /* * Convert an ICMP "type" field to a printable string. */ -char * -pr_type(t0) - int t0; +const char * +pr_type(int t0) { u_char t = t0 & 0xff; - char *cp; + const char *cp; switch (t) { case ICMP6_DST_UNREACH: @@ -1221,7 +1220,7 @@ packet_ok(mhdr, cc, seq) cc -= hlen; icp = (struct icmp6_hdr *)(buf + hlen); #else - if (cc < sizeof(struct icmp6_hdr)) { + if (cc < (int)sizeof(struct icmp6_hdr)) { if (verbose) { if (getnameinfo((struct sockaddr *)from, from->sin6_len, hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0) |