Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Feb 2010 10:19:39 +0000 (UTC)
From:      Ulrich Spoerlein <uqs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r204407 - in head: sbin/rtsol usr.sbin/rtsold
Message-ID:  <201002271019.o1RAJdPC030620@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: uqs
Date: Sat Feb 27 10:19:39 2010
New Revision: 204407
URL: http://svn.freebsd.org/changeset/base/204407

Log:
  rtsol(8)/rtsold(8): make WARNS=3 clean
  
  It is actually WARNS=6 clean for non-strict alignment archs.
  
  Approved by:	ed (co-mentor)

Modified:
  head/sbin/rtsol/Makefile
  head/usr.sbin/rtsold/Makefile
  head/usr.sbin/rtsold/dump.c
  head/usr.sbin/rtsold/if.c
  head/usr.sbin/rtsold/rtsock.c
  head/usr.sbin/rtsold/rtsol.c
  head/usr.sbin/rtsold/rtsold.c
  head/usr.sbin/rtsold/rtsold.h

Modified: head/sbin/rtsol/Makefile
==============================================================================
--- head/sbin/rtsol/Makefile	Sat Feb 27 10:18:33 2010	(r204406)
+++ head/sbin/rtsol/Makefile	Sat Feb 27 10:19:39 2010	(r204407)
@@ -21,8 +21,8 @@ SRCDIR=	${.CURDIR}/../../usr.sbin/rtsold
 PROG=	rtsol
 SRCS=	rtsold.c rtsol.c if.c probe.c rtsock.c
 NO_MAN=
-WARNS?=	0
 
+WARNS?=	3
 CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H -DSMALL
 
 .include <bsd.prog.mk>

Modified: head/usr.sbin/rtsold/Makefile
==============================================================================
--- head/usr.sbin/rtsold/Makefile	Sat Feb 27 10:18:33 2010	(r204406)
+++ head/usr.sbin/rtsold/Makefile	Sat Feb 27 10:19:39 2010	(r204407)
@@ -19,10 +19,8 @@ MAN=	rtsold.8
 MLINKS=	rtsold.8 rtsol.8
 SRCS=	rtsold.c rtsol.c if.c probe.c dump.c rtsock.c
 
+WARNS?=	3
 CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H
-
-WARNS?=	1
-
 DPADD=	${LIBKVM}
 LDADD=	-lkvm
 

Modified: head/usr.sbin/rtsold/dump.c
==============================================================================
--- head/usr.sbin/rtsold/dump.c	Sat Feb 27 10:18:33 2010	(r204406)
+++ head/usr.sbin/rtsold/dump.c	Sat Feb 27 10:19:39 2010	(r204407)
@@ -52,8 +52,8 @@ static FILE *fp;
 extern struct ifinfo *iflist;
 
 static void dump_interface_status(void);
-static char *sec2str(time_t);
-char *ifstatstr[] = {"IDLE", "DELAY", "PROBE", "DOWN", "TENTATIVE"};
+static const char *sec2str(time_t);
+static const char * const ifstatstr[] = {"IDLE", "DELAY", "PROBE", "DOWN", "TENTATIVE"};
 
 static void
 dump_interface_status(void)
@@ -97,7 +97,7 @@ dump_interface_status(void)
 }
 
 void
-rtsold_dump_file(char *dumpfile)
+rtsold_dump_file(const char *dumpfile)
 {
 	if ((fp = fopen(dumpfile, "w")) == NULL) {
 		warnmsg(LOG_WARNING, __func__, "open a dump file(%s): %s",
@@ -108,7 +108,7 @@ rtsold_dump_file(char *dumpfile)
 	fclose(fp);
 }
 
-static char *
+static const char *
 sec2str(time_t total)
 {
 	static char result[256];

Modified: head/usr.sbin/rtsold/if.c
==============================================================================
--- head/usr.sbin/rtsold/if.c	Sat Feb 27 10:18:33 2010	(r204406)
+++ head/usr.sbin/rtsold/if.c	Sat Feb 27 10:19:39 2010	(r204407)
@@ -82,7 +82,6 @@ interface_up(char *name)
 	struct in6_ndireq nd;
 	int llflag;
 	int s;
-	int error;
 
 	memset(&ifr, 0, sizeof(ifr));
 	strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));

Modified: head/usr.sbin/rtsold/rtsock.c
==============================================================================
--- head/usr.sbin/rtsold/rtsock.c	Sat Feb 27 10:18:33 2010	(r204406)
+++ head/usr.sbin/rtsold/rtsock.c	Sat Feb 27 10:19:39 2010	(r204407)
@@ -94,9 +94,9 @@ rtsock_input(int s)
 	char *lim, *next;
 	struct rt_msghdr *rtm;
 	int idx;
-	size_t len;
+	ssize_t len;
 	int ret = 0;
-	const size_t lenlim =
+	const ssize_t lenlim =
 	    offsetof(struct rt_msghdr, rtm_msglen) + sizeof(rtm->rtm_msglen);
 
 	n = read(s, msg, sizeof(msg));
@@ -135,7 +135,7 @@ rtsock_input(int s)
 
 #ifdef RTM_IFANNOUNCE	/*NetBSD 1.5 or later*/
 static int
-rtsock_input_ifannounce(int s, struct rt_msghdr *rtm, char *lim)
+rtsock_input_ifannounce(int s __unused, struct rt_msghdr *rtm, char *lim)
 {
 	struct if_announcemsghdr *ifan;
 	struct ifinfo *ifinfo;

Modified: head/usr.sbin/rtsold/rtsol.c
==============================================================================
--- head/usr.sbin/rtsold/rtsol.c	Sat Feb 27 10:18:33 2010	(r204406)
+++ head/usr.sbin/rtsold/rtsol.c	Sat Feb 27 10:19:39 2010	(r204407)
@@ -72,8 +72,10 @@ static int rcvcmsglen;
 
 int rssock;
 
-static struct sockaddr_in6 sin6_allrouters =
-{sizeof(sin6_allrouters), AF_INET6};
+static struct sockaddr_in6 sin6_allrouters = {
+	.sin6_len =	sizeof(sin6_allrouters),
+	.sin6_family =	AF_INET6,
+};
 
 static void call_script(char *, char *);
 static int safefile(const char *);
@@ -183,7 +185,7 @@ sendpacket(struct ifinfo *ifinfo)
 	struct in6_pktinfo *pi;
 	struct cmsghdr *cm;
 	int hoplimit = 255;
-	int i;
+	ssize_t i;
 	struct sockaddr_in6 dst;
 
 	dst = sin6_allrouters;
@@ -213,7 +215,7 @@ sendpacket(struct ifinfo *ifinfo)
 	    "send RS on %s, whose state is %d",
 	    ifinfo->ifname, ifinfo->state);
 	i = sendmsg(rssock, &sndmhdr, 0);
-	if (i < 0 || i != ifinfo->rs_datalen) {
+	if (i < 0 || (size_t)i != ifinfo->rs_datalen) {
 		/*
 		 * ENETDOWN is not so serious, especially when using several
 		 * network cards on a mobile node. We ignore it.
@@ -231,7 +233,8 @@ void
 rtsol_input(int s)
 {
 	u_char ntopbuf[INET6_ADDRSTRLEN], ifnamebuf[IFNAMSIZ];
-	int ifindex = 0, i, *hlimp = NULL;
+	int ifindex = 0, *hlimp = NULL;
+	ssize_t i;
 	struct in6_pktinfo *pi = NULL;
 	struct ifinfo *ifi = NULL;
 	struct icmp6_hdr *icp;
@@ -272,9 +275,9 @@ rtsol_input(int s)
 		return;
 	}
 
-	if (i < sizeof(struct nd_router_advert)) {
+	if ((size_t)i < sizeof(struct nd_router_advert)) {
 		warnmsg(LOG_INFO, __func__,
-		    "packet size(%d) is too short", i);
+		    "packet size(%zd) is too short", i);
 		return;
 	}
 

Modified: head/usr.sbin/rtsold/rtsold.c
==============================================================================
--- head/usr.sbin/rtsold/rtsold.c	Sat Feb 27 10:18:33 2010	(r204406)
+++ head/usr.sbin/rtsold/rtsold.c	Sat Feb 27 10:19:39 2010	(r204407)
@@ -91,10 +91,10 @@ int main(int, char **);
 static int mobile_node = 0;
 #ifndef SMALL
 static int do_dump;
-static char *dumpfilename = "/var/run/rtsold.dump"; /* XXX: should be configurable */
+static const char *dumpfilename = "/var/run/rtsold.dump"; /* XXX: should be configurable */
 #endif
 #if 1
-static char *pidfilename = "/var/run/rtsold.pid"; /* should be configurable */
+static const char *pidfilename = "/var/run/rtsold.pid"; /* should be configurable */
 #endif
 
 #if 0
@@ -113,7 +113,8 @@ main(int argc, char **argv)
 {
 	int s, ch, once = 0;
 	struct timeval *timeout;
-	char *argv0, *opts;
+	char *argv0;
+	const char *opts;
 #ifdef HAVE_POLL_H
 	struct pollfd set[2];
 #else
@@ -734,7 +735,7 @@ rtsol_timer_update(struct ifinfo *ifinfo
 
 #ifndef SMALL
 static void
-rtsold_set_dump_file(int sig)
+rtsold_set_dump_file(int sig __unused)
 {
 	do_dump = 1;
 }
@@ -790,7 +791,7 @@ autoifprobe(void)
 	static char **argv = NULL;
 	static int n = 0;
 	char **a;
-	int s, i, found;
+	int s = 0, i, found;
 	struct ifaddrs *ifap, *ifa, *target;
 	struct in6_ndireq nd;
 

Modified: head/usr.sbin/rtsold/rtsold.h
==============================================================================
--- head/usr.sbin/rtsold/rtsold.h	Sat Feb 27 10:18:33 2010	(r204406)
+++ head/usr.sbin/rtsold/rtsold.h	Sat Feb 27 10:19:39 2010	(r204407)
@@ -97,7 +97,7 @@ extern int probe_init(void);
 extern void defrouter_probe(struct ifinfo *);
 
 /* dump.c */
-extern void rtsold_dump_file(char *);
+extern void rtsold_dump_file(const char *);
 
 /* rtsock.c */
 extern int rtsock_open(void);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002271019.o1RAJdPC030620>