traceroute6(8): make WARNS=3 clean

This commit is contained in:
uqs 2010-12-04 14:19:35 +00:00
parent 1651f46830
commit 0114bdf52f
2 changed files with 14 additions and 15 deletions

View File

@ -25,7 +25,7 @@ BINMODE= 4555
CFLAGS+= -DIPSEC -DUSE_RFC2292BIS -DHAVE_POLL CFLAGS+= -DIPSEC -DUSE_RFC2292BIS -DHAVE_POLL
CFLAGS+= -I${.CURDIR} -I${TRACEROUTE_DISTDIR} -I. CFLAGS+= -I${.CURDIR} -I${TRACEROUTE_DISTDIR} -I.
WARNS?= 1 WARNS?= 3
DPADD= ${LIBIPSEC} DPADD= ${LIBIPSEC}
LDADD= -lipsec LDADD= -lipsec

View File

@ -66,7 +66,7 @@
*/ */
#ifndef lint #ifndef lint
static char copyright[] = static const char copyright[] =
"@(#) Copyright (c) 1990, 1993\n\ "@(#) Copyright (c) 1990, 1993\n\
The Regents of the University of California. All rights reserved.\n"; The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
@ -322,7 +322,7 @@ void send_probe(int, u_long);
void *get_uphdr(struct ip6_hdr *, u_char *); void *get_uphdr(struct ip6_hdr *, u_char *);
int get_hoplim(struct msghdr *); int get_hoplim(struct msghdr *);
double deltaT(struct timeval *, struct timeval *); double deltaT(struct timeval *, struct timeval *);
char *pr_type(int); const char *pr_type(int);
int packet_ok(struct msghdr *, int, int); int packet_ok(struct msghdr *, int, int);
void print(struct msghdr *, int); void print(struct msghdr *, int);
const char *inetname(struct sockaddr *); const char *inetname(struct sockaddr *);
@ -372,12 +372,12 @@ main(argc, argv)
{ {
int mib[4] = { CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_DEFHLIM }; int mib[4] = { CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_DEFHLIM };
char hbuf[NI_MAXHOST], src0[NI_MAXHOST], *ep; 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; struct addrinfo hints, *res;
static u_char *rcvcmsgbuf; static u_char *rcvcmsgbuf;
u_long probe, hops, lport; u_long probe, hops, lport;
struct hostent *hp; struct hostent *hp;
size_t size; size_t size, minlen;
uid_t uid; uid_t uid;
/* /*
@ -671,11 +671,11 @@ main(argc, argv)
datalen = minlen; datalen = minlen;
else if (datalen >= MAXPACKET) { else if (datalen >= MAXPACKET) {
fprintf(stderr, fprintf(stderr,
"traceroute6: packet size must be %d <= s < %ld.\n", "traceroute6: packet size must be %zu <= s < %d.\n",
minlen, (long)MAXPACKET); minlen, MAXPACKET);
exit(1); exit(1);
} }
outpacket = (struct opacket *)malloc((unsigned)datalen); outpacket = malloc(datalen);
if (!outpacket) { if (!outpacket) {
perror("malloc"); perror("malloc");
exit(1); exit(1);
@ -913,7 +913,7 @@ main(argc, argv)
for (hops = first_hop; hops <= max_hops; ++hops) { for (hops = first_hop; hops <= max_hops; ++hops) {
struct in6_addr lastaddr; struct in6_addr lastaddr;
int got_there = 0; int got_there = 0;
int unreachable = 0; unsigned unreachable = 0;
printf("%2lu ", hops); printf("%2lu ", hops);
bzero(&lastaddr, sizeof(lastaddr)); bzero(&lastaddr, sizeof(lastaddr));
@ -1089,7 +1089,7 @@ send_probe(seq, hops)
i = sendto(sndsock, (char *)outpacket, datalen, 0, i = sendto(sndsock, (char *)outpacket, datalen, 0,
(struct sockaddr *)&Dst, Dst.sin6_len); (struct sockaddr *)&Dst, Dst.sin6_len);
if (i < 0 || i != datalen) { if (i < 0 || (u_long)i != datalen) {
if (i < 0) if (i < 0)
perror("sendto"); perror("sendto");
printf("traceroute6: wrote %s %lu chars, ret=%d\n", 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. * Convert an ICMP "type" field to a printable string.
*/ */
char * const char *
pr_type(t0) pr_type(int t0)
int t0;
{ {
u_char t = t0 & 0xff; u_char t = t0 & 0xff;
char *cp; const char *cp;
switch (t) { switch (t) {
case ICMP6_DST_UNREACH: case ICMP6_DST_UNREACH:
@ -1221,7 +1220,7 @@ packet_ok(mhdr, cc, seq)
cc -= hlen; cc -= hlen;
icp = (struct icmp6_hdr *)(buf + hlen); icp = (struct icmp6_hdr *)(buf + hlen);
#else #else
if (cc < sizeof(struct icmp6_hdr)) { if (cc < (int)sizeof(struct icmp6_hdr)) {
if (verbose) { if (verbose) {
if (getnameinfo((struct sockaddr *)from, from->sin6_len, if (getnameinfo((struct sockaddr *)from, from->sin6_len,
hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0) hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0)