Module Name:    src
Committed By:   lukem
Date:           Sat Apr 11 07:51:59 UTC 2009

Modified Files:
        src/usr.sbin/rtsold: Makefile dump.c rtsock.c rtsol.c rtsold.c rtsold.h

Log Message:
fix WARNS=4 issues


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/rtsold/Makefile
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/rtsold/dump.c \
    src/usr.sbin/rtsold/rtsold.h
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/rtsold/rtsock.c
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/rtsold/rtsol.c
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/rtsold/rtsold.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/rtsold/Makefile
diff -u src/usr.sbin/rtsold/Makefile:1.12 src/usr.sbin/rtsold/Makefile:1.13
--- src/usr.sbin/rtsold/Makefile:1.12	Mon May 28 12:06:40 2007
+++ src/usr.sbin/rtsold/Makefile	Sat Apr 11 07:51:59 2009
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.12 2007/05/28 12:06:40 tls Exp $
+# $NetBSD: Makefile,v 1.13 2009/04/11 07:51:59 lukem Exp $
 
 USE_FORT?= yes	# network client (local server)
+WARNS?=	4
 
 PROG=	rtsold
 SRCS=	rtsold.c rtsol.c if.c probe.c dump.c rtsock.c

Index: src/usr.sbin/rtsold/dump.c
diff -u src/usr.sbin/rtsold/dump.c:1.8 src/usr.sbin/rtsold/dump.c:1.9
--- src/usr.sbin/rtsold/dump.c:1.8	Sat Jan  3 01:40:31 2004
+++ src/usr.sbin/rtsold/dump.c	Sat Apr 11 07:51:59 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: dump.c,v 1.8 2004/01/03 01:40:31 itojun Exp $	*/
+/*	$NetBSD: dump.c,v 1.9 2009/04/11 07:51:59 lukem Exp $	*/
 /*	$KAME: dump.c,v 1.10 2002/05/31 10:10:03 itojun Exp $	*/
 
 /*
@@ -51,8 +51,8 @@
 extern struct ifinfo *iflist;
 
 static void dump_interface_status __P((void));
-static char *sec2str __P((time_t));
-char *ifstatstr[] = {"IDLE", "DELAY", "PROBE", "DOWN", "TENTATIVE"};
+static const char *sec2str __P((time_t));
+const char *ifstatstr[] = {"IDLE", "DELAY", "PROBE", "DOWN", "TENTATIVE"};
 
 static void
 dump_interface_status(void)
@@ -94,7 +94,7 @@
 }
 
 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",
@@ -105,7 +105,7 @@
 	fclose(fp);
 }
 
-static char *
+static const char *
 sec2str(time_t total)
 {
 	static char result[256];
Index: src/usr.sbin/rtsold/rtsold.h
diff -u src/usr.sbin/rtsold/rtsold.h:1.8 src/usr.sbin/rtsold/rtsold.h:1.9
--- src/usr.sbin/rtsold/rtsold.h:1.8	Fri May 31 10:22:17 2002
+++ src/usr.sbin/rtsold/rtsold.h	Sat Apr 11 07:51:59 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsold.h,v 1.8 2002/05/31 10:22:17 itojun Exp $	*/
+/*	$NetBSD: rtsold.h,v 1.9 2009/04/11 07:51:59 lukem Exp $	*/
 /*	$KAME: rtsold.h,v 1.14 2002/05/31 10:10:03 itojun Exp $	*/
 
 /*
@@ -91,7 +91,7 @@
 extern void defrouter_probe __P((struct ifinfo *));
 
 /* dump.c */
-extern void rtsold_dump_file __P((char *));
+extern void rtsold_dump_file __P((const char *));
 
 /* rtsock.c */
 extern int rtsock_open __P((void));

Index: src/usr.sbin/rtsold/rtsock.c
diff -u src/usr.sbin/rtsold/rtsock.c:1.5 src/usr.sbin/rtsold/rtsock.c:1.6
--- src/usr.sbin/rtsold/rtsock.c:1.5	Sat Jan  3 01:40:32 2004
+++ src/usr.sbin/rtsold/rtsock.c	Sat Apr 11 07:51:59 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.5 2004/01/03 01:40:32 itojun Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.6 2009/04/11 07:51:59 lukem Exp $	*/
 /*	$KAME: rtsock.c,v 1.4 2001/09/19 06:59:41 sakane Exp $	*/
 
 /*
@@ -104,7 +104,7 @@
 	lim = msg + n;
 	for (next = msg; next < lim; next += len) {
 		rtm = (struct rt_msghdr *)next;
-		if (lim - next < lenlim)
+		if (lim - next < (intptr_t)lenlim)
 			break;
 		len = rtm->rtm_msglen;
 		if (len < lenlim)

Index: src/usr.sbin/rtsold/rtsol.c
diff -u src/usr.sbin/rtsold/rtsol.c:1.14 src/usr.sbin/rtsold/rtsol.c:1.15
--- src/usr.sbin/rtsold/rtsol.c:1.14	Thu Sep  6 09:26:21 2007
+++ src/usr.sbin/rtsold/rtsol.c	Sat Apr 11 07:51:59 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsol.c,v 1.14 2007/09/06 09:26:21 jnemeth Exp $	*/
+/*	$NetBSD: rtsol.c,v 1.15 2009/04/11 07:51:59 lukem Exp $	*/
 /*	$KAME: rtsol.c,v 1.15 2002/05/31 10:10:03 itojun Exp $	*/
 
 /*
@@ -179,7 +179,7 @@
 	struct in6_pktinfo *pi;
 	struct cmsghdr *cm;
 	int hoplimit = 255;
-	int i;
+	ssize_t i;
 	struct sockaddr_in6 dst;
 
 	dst = sin6_allrouters;
@@ -211,7 +211,7 @@
 
 	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.
@@ -229,7 +229,8 @@
 rtsol_input(int s)
 {
 	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;
@@ -267,9 +268,9 @@
 		return;
 	}
 
-	if (i < sizeof(struct nd_router_advert)) {
+	if (i < (ssize_t)sizeof(struct nd_router_advert)) {
 		warnmsg(LOG_ERR, __func__,
-		    "packet size(%d) is too short", i);
+		    "packet size(%zd) is too short", i);
 		return;
 	}
 

Index: src/usr.sbin/rtsold/rtsold.c
diff -u src/usr.sbin/rtsold/rtsold.c:1.34 src/usr.sbin/rtsold/rtsold.c:1.35
--- src/usr.sbin/rtsold/rtsold.c:1.34	Mon Jun 23 04:55:27 2008
+++ src/usr.sbin/rtsold/rtsold.c	Sat Apr 11 07:51:59 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsold.c,v 1.34 2008/06/23 04:55:27 dholland Exp $	*/
+/*	$NetBSD: rtsold.c,v 1.35 2009/04/11 07:51:59 lukem Exp $	*/
 /*	$KAME: rtsold.c,v 1.77 2004/01/03 01:35:13 itojun Exp $	*/
 
 /*
@@ -102,7 +102,7 @@
 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 0

Reply via email to