Source-Changes-HG archive

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

[src/trunk]: src/libexec/ftpd PR/44390: Paul Koning: make code gcc-4.5.1 frie...



details:   https://anonhg.NetBSD.org/src/rev/9f4974efe88c
branches:  trunk
changeset: 760872:9f4974efe88c
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jan 14 23:56:13 2011 +0000

description:
PR/44390: Paul Koning: make code gcc-4.5.1 friendly.

diffstat:

 libexec/ftpd/ftpcmd.y |  28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diffs (52 lines):

diff -r 3e81d5c05843 -r 9f4974efe88c libexec/ftpd/ftpcmd.y
--- a/libexec/ftpd/ftpcmd.y     Fri Jan 14 23:35:07 2011 +0000
+++ b/libexec/ftpd/ftpcmd.y     Fri Jan 14 23:56:13 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ftpcmd.y,v 1.90 2009/07/13 19:05:40 roy Exp $  */
+/*     $NetBSD: ftpcmd.y,v 1.91 2011/01/14 23:56:13 christos Exp $     */
 
 /*-
  * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
 #if 0
 static char sccsid[] = "@(#)ftpcmd.y   8.3 (Berkeley) 4/6/94";
 #else
-__RCSID("$NetBSD: ftpcmd.y,v 1.90 2009/07/13 19:05:40 roy Exp $");
+__RCSID("$NetBSD: ftpcmd.y,v 1.91 2011/01/14 23:56:13 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -967,18 +967,24 @@
                NUMBER
                {
 #ifdef INET6
-                       char *a, *p;
+                       unsigned char buf[16];
 
-                       memset(&data_dest, 0, sizeof(data_dest));
+                       (void)memset(&data_dest, 0, sizeof(data_dest));
                        data_dest.su_len = sizeof(struct sockaddr_in6);
                        data_dest.su_family = AF_INET6;
-                       p = (char *)&data_dest.su_port;
-                       p[0] = $39.i; p[1] = $41.i;
-                       a = (char *)&data_dest.si_su.su_sin6.sin6_addr;
-                       a[0] = $5.i; a[1] = $7.i; a[2] = $9.i; a[3] = $11.i;
-                       a[4] = $13.i; a[5] = $15.i; a[6] = $17.i; a[7] = $19.i;
-                       a[8] = $21.i; a[9] = $23.i; a[10] = $25.i; a[11] = $27.i;
-                       a[12] = $29.i; a[13] = $31.i; a[14] = $33.i; a[15] = $35.i;
+                       buf[0] = $39.i; buf[1] = $41.i;
+                       (void)memcpy(&data_dest.su_port, buf,
+                           sizeof(&data_dest.su_port));
+                       buf[0] = $5.i; buf[1] = $7.i;
+                       buf[2] = $9.i; buf[3] = $11.i;
+                       buf[4] = $13.i; buf[5] = $15.i;
+                       buf[6] = $17.i; buf[7] = $19.i;
+                       buf[8] = $21.i; buf[9] = $23.i;
+                       buf[10] = $25.i; buf[11] = $27.i;
+                       buf[12] = $29.i; buf[13] = $31.i;
+                       buf[14] = $33.i; buf[15] = $35.i;
+                       (void)memcpy(&data_dest.si_su.su_sin6.sin6_addr,
+                           buf, sizeof(data_dest.si_su.su_sin6.sin6_addr));
                        if (his_addr.su_family == AF_INET6) {
                                /* XXX: more sanity checks! */
                                data_dest.su_scope_id = his_addr.su_scope_id;



Home | Main Index | Thread Index | Old Index