Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/cnwctl avoid pointer gymnastics



details:   https://anonhg.NetBSD.org/src/rev/5c4e2fc06391
branches:  trunk
changeset: 790697:5c4e2fc06391
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Oct 19 17:05:58 2013 +0000

description:
avoid pointer gymnastics

diffstat:

 usr.sbin/cnwctl/cnwctl.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (22 lines):

diff -r fe1b5595f6fb -r 5c4e2fc06391 usr.sbin/cnwctl/cnwctl.c
--- a/usr.sbin/cnwctl/cnwctl.c  Sat Oct 19 17:04:41 2013 +0000
+++ b/usr.sbin/cnwctl/cnwctl.c  Sat Oct 19 17:05:58 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cnwctl.c,v 1.7 2008/05/02 19:59:19 xtraeme Exp $       */
+/*     $NetBSD: cnwctl.c,v 1.8 2013/10/19 17:05:58 christos Exp $      */
 
 /*
  * Copyright (c) 1997 Berkeley Software Design, Inc.
@@ -210,8 +210,10 @@
                    cnws.data[0x58]);
                printf("      0x%02x mhs\n",
                    cnws.data[0x6b]);
-               printf(" %04x %04x revision\n",
-                   *(u_short *)&cnws.data[0x66], *(u_short *)&cnws.data[0x68]);
+               u_short x, y;
+               memcpy(&x, &cnws.data[0x66], sizeof(x));
+               memcpy(&y, &cnws.data[0x68], sizeof(y));
+               printf(" %04x %04x revision\n", x, y);
                printf("        %c%c id\n",
                    cnws.data[0x6e], cnws.data[0x6f]);
        }



Home | Main Index | Thread Index | Old Index