Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/ftp portability fixes for lukemftp:



details:   https://anonhg.NetBSD.org/src/rev/baf0cca2df1b
branches:  trunk
changeset: 487665:baf0cca2df1b
user:      lukem <lukem%NetBSD.org@localhost>
date:      Sun Jun 11 02:12:05 2000 +0000

description:
portability fixes for lukemftp:
* initconn(): use in_addr_t instead of u_int32_t when manipulating IPv6
  addresses (and assume anything with ipv6 has in_addr_t; if not, i'll
  add an autoconf test for it)
* ai_unmapped(): not all systems have sin_len; so only set #ifdef BSD4_4
* fix some lint

diffstat:

 usr.bin/ftp/ftp.c     |  18 +++++++++++-------
 usr.bin/ftp/main.c    |   5 +++--
 usr.bin/ftp/version.h |   4 ++--
 3 files changed, 16 insertions(+), 11 deletions(-)

diffs (99 lines):

diff -r 4e3bb2704417 -r baf0cca2df1b usr.bin/ftp/ftp.c
--- a/usr.bin/ftp/ftp.c Sun Jun 11 01:59:26 2000 +0000
+++ b/usr.bin/ftp/ftp.c Sun Jun 11 02:12:05 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ftp.c,v 1.98 2000/06/05 09:22:53 lukem Exp $   */
+/*     $NetBSD: ftp.c,v 1.99 2000/06/11 02:12:05 lukem Exp $   */
 
 /*-
  * Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
@@ -103,7 +103,7 @@
 #if 0
 static char sccsid[] = "@(#)ftp.c      8.6 (Berkeley) 10/27/94";
 #else
-__RCSID("$NetBSD: ftp.c,v 1.98 2000/06/05 09:22:53 lukem Exp $");
+__RCSID("$NetBSD: ftp.c,v 1.99 2000/06/11 02:12:05 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -1596,8 +1596,8 @@
                                data_addr.su_family = AF_INET6;
                                data_addr.su_len = sizeof(struct sockaddr_in6);
                            {
-                               u_int32_t *p32;
-                               p32 = (u_int32_t *)&data_addr.su_sin6.sin6_addr;
+                               in_addr_t *p32;
+                               p32 = (in_addr_t *)&data_addr.su_sin6.sin6_addr;
                                p32[0] = htonl(pack4(addr, 0));
                                p32[1] = htonl(pack4(addr, 4));
                                p32[2] = htonl(pack4(addr, 8));
@@ -2209,6 +2209,7 @@
 #ifdef INET6
        struct sockaddr_in6 *sin6;
        struct sockaddr_in sin;
+       int len;
 
        if (ai->ai_family != AF_INET6)
                return;
@@ -2221,13 +2222,16 @@
 
        memset(&sin, 0, sizeof(sin));
        sin.sin_family = AF_INET;
-       sin.sin_len = sizeof(struct sockaddr_in);
+       len = sizeof(struct sockaddr_in);
        memcpy(&sin.sin_addr, &sin6->sin6_addr.s6_addr[12],
            sizeof(sin.sin_addr));
        sin.sin_port = sin6->sin6_port;
 
        ai->ai_family = AF_INET;
-       memcpy(ai->ai_addr, &sin, sin.sin_len);
-       ai->ai_addrlen = sin.sin_len;
+#ifdef BSD4_4
+       sin.sin_len = len;
+#endif
+       memcpy(ai->ai_addr, &sin, len);
+       ai->ai_addrlen = len;
 #endif
 }
diff -r 4e3bb2704417 -r baf0cca2df1b usr.bin/ftp/main.c
--- a/usr.bin/ftp/main.c        Sun Jun 11 01:59:26 2000 +0000
+++ b/usr.bin/ftp/main.c        Sun Jun 11 02:12:05 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.71 2000/05/31 14:23:59 lukem Exp $  */
+/*     $NetBSD: main.c,v 1.72 2000/06/11 02:12:06 lukem Exp $  */
 
 /*-
  * Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
@@ -108,7 +108,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.6 (Berkeley) 10/9/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.71 2000/05/31 14:23:59 lukem Exp $");
+__RCSID("$NetBSD: main.c,v 1.72 2000/06/11 02:12:06 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -950,6 +950,7 @@
        if (c != NULL)
                return (c->value);
        errx(1, "getoptionvalue() invoked with unknown option `%s'", name);
+       /* NOTREACHED */
 }
 
 static void
diff -r 4e3bb2704417 -r baf0cca2df1b usr.bin/ftp/version.h
--- a/usr.bin/ftp/version.h     Sun Jun 11 01:59:26 2000 +0000
+++ b/usr.bin/ftp/version.h     Sun Jun 11 02:12:05 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.11 2000/06/05 09:22:53 lukem Exp $       */
+/*     $NetBSD: version.h,v 1.12 2000/06/11 02:12:06 lukem Exp $       */
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -40,5 +40,5 @@
 #endif
 
 #ifndef FTP_VERSION
-#define        FTP_VERSION     "20000605"
+#define        FTP_VERSION     "20000611"
 #endif



Home | Main Index | Thread Index | Old Index