svn commit: r193977 - stable/7/usr.sbin/arp

Dag-Erling Smorgrav des at FreeBSD.org
Thu Jun 11 07:52:36 UTC 2009


Author: des
Date: Thu Jun 11 07:52:35 2009
New Revision: 193977
URL: http://svn.freebsd.org/changeset/base/193977

Log:
  merge r173716, r175206, r193976: silence warning, WARNS=6, prettify macro.

Modified:
  stable/7/usr.sbin/arp/   (props changed)
  stable/7/usr.sbin/arp/Makefile
  stable/7/usr.sbin/arp/arp.c

Modified: stable/7/usr.sbin/arp/Makefile
==============================================================================
--- stable/7/usr.sbin/arp/Makefile	Thu Jun 11 07:50:36 2009	(r193976)
+++ stable/7/usr.sbin/arp/Makefile	Thu Jun 11 07:52:35 2009	(r193977)
@@ -4,6 +4,6 @@
 PROG=	arp
 MAN=	arp.4 arp.8
 
-WARNS?=	3
+WARNS?=	6
 
 .include <bsd.prog.mk>

Modified: stable/7/usr.sbin/arp/arp.c
==============================================================================
--- stable/7/usr.sbin/arp/arp.c	Thu Jun 11 07:50:36 2009	(r193976)
+++ stable/7/usr.sbin/arp/arp.c	Thu Jun 11 07:52:35 2009	(r193977)
@@ -648,7 +648,7 @@ rtmsg(int cmd, struct sockaddr_inarp *ds
 	static int seq;
 	int rlen;
 	int l;
-	struct sockaddr_in so_mask;
+	struct sockaddr_in so_mask, *som = &so_mask;
 	static int s = -1;
 	static pid_t pid;
 
@@ -702,13 +702,17 @@ rtmsg(int cmd, struct sockaddr_inarp *ds
 	case RTM_GET:
 		rtm->rtm_addrs |= RTA_DST;
 	}
-#define NEXTADDR(w, s) \
-	if ((s) != NULL && rtm->rtm_addrs & (w)) { \
-		bcopy((s), cp, sizeof(*(s))); cp += SA_SIZE(s);}
+#define NEXTADDR(w, s)					   \
+	do {						   \
+		if ((s) != NULL && rtm->rtm_addrs & (w)) { \
+			bcopy((s), cp, sizeof(*(s)));	   \
+			cp += SA_SIZE(s);		   \
+		}					   \
+	} while (0)
 
 	NEXTADDR(RTA_DST, dst);
 	NEXTADDR(RTA_GATEWAY, sdl);
-	NEXTADDR(RTA_NETMASK, &so_mask);
+	NEXTADDR(RTA_NETMASK, som);
 
 	rtm->rtm_msglen = cp - (char *)&m_rtmsg;
 doit:


More information about the svn-src-all mailing list