Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/ifconfig use memcpy to avoid strict aliasing warnings



details:   https://anonhg.NetBSD.org/src/rev/1b46c02d0baa
branches:  trunk
changeset: 768310:1b46c02d0baa
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Aug 14 12:15:15 2011 +0000

description:
use memcpy to avoid strict aliasing warnings

diffstat:

 sbin/ifconfig/Makefile   |  7 +------
 sbin/ifconfig/af_atalk.c |  6 +++---
 2 files changed, 4 insertions(+), 9 deletions(-)

diffs (45 lines):

diff -r 5aa6a4bddc49 -r 1b46c02d0baa sbin/ifconfig/Makefile
--- a/sbin/ifconfig/Makefile    Sun Aug 14 12:13:24 2011 +0000
+++ b/sbin/ifconfig/Makefile    Sun Aug 14 12:15:15 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.51 2011/06/22 02:49:43 mrg Exp $
+#      $NetBSD: Makefile,v 1.52 2011/08/14 12:15:15 christos Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/5/93
 
 # when making a change to this file, please check if the change is
@@ -32,8 +32,3 @@
 .endif
 
 .include <bsd.prog.mk>
-
-# XXX
-.if ${HAVE_GCC} == 45
-COPTS.af_atalk.c+=     -fno-strict-aliasing
-.endif
diff -r 5aa6a4bddc49 -r 1b46c02d0baa sbin/ifconfig/af_atalk.c
--- a/sbin/ifconfig/af_atalk.c  Sun Aug 14 12:13:24 2011 +0000
+++ b/sbin/ifconfig/af_atalk.c  Sun Aug 14 12:15:15 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: af_atalk.c,v 1.17 2010/12/13 17:35:08 pooka Exp $      */
+/*     $NetBSD: af_atalk.c,v 1.18 2011/08/14 12:15:15 christos Exp $   */
 
 /*
  * Copyright (c) 1983, 1993
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: af_atalk.c,v 1.17 2010/12/13 17:35:08 pooka Exp $");
+__RCSID("$NetBSD: af_atalk.c,v 1.18 2011/08/14 12:15:15 christos Exp $");
 #endif /* not lint */
 
 #include <sys/param.h> 
@@ -150,7 +150,7 @@
        if (ntohs(nr.nr_firstnet) > ntohs(sat->sat_addr.s_net) ||
            ntohs(nr.nr_lastnet) < ntohs(sat->sat_addr.s_net))
                errx(EXIT_FAILURE, "AppleTalk address is not in range");
-       *((struct netrange *)&sat->sat_zero) = nr;
+       memcpy(&sat->sat_zero, &nr, sizeof(nr));
 
        /* Copy the new address to a temporary input environment */
 



Home | Main Index | Thread Index | Old Index