Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/ftp As discussed on tech-net@: Don't display expecte...



details:   https://anonhg.NetBSD.org/src/rev/a9a10a43a670
branches:  trunk
changeset: 779986:a9a10a43a670
user:      is <is%NetBSD.org@localhost>
date:      Wed Jul 04 06:09:37 2012 +0000

description:
As discussed on tech-net@: Don't display expected EHOSTUNREACH for all but
the last connect attempts in terse mode.

diffstat:

 usr.bin/ftp/extern.h |  4 ++--
 usr.bin/ftp/fetch.c  |  7 ++++---
 usr.bin/ftp/ftp.c    |  9 +++++----
 usr.bin/ftp/util.c   |  9 +++++----
 4 files changed, 16 insertions(+), 13 deletions(-)

diffs (121 lines):

diff -r dcb777be1fbd -r a9a10a43a670 usr.bin/ftp/extern.h
--- a/usr.bin/ftp/extern.h      Wed Jul 04 01:08:57 2012 +0000
+++ b/usr.bin/ftp/extern.h      Wed Jul 04 06:09:37 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.79 2011/09/16 15:39:26 joerg Exp $        */
+/*     $NetBSD: extern.h,v 1.80 2012/07/04 06:09:37 is Exp $   */
 
 /*-
  * Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
@@ -239,7 +239,7 @@
 void   updatelocalcwd(void);
 void   updateremotecwd(void);
 void   user(int, char **);
-int    ftp_connect(int, const struct sockaddr *, socklen_t);
+int    ftp_connect(int, const struct sockaddr *, socklen_t, int);
 int    ftp_listen(int, int);
 int    ftp_poll(struct pollfd *, int, int);
 void   *ftp_malloc(size_t);
diff -r dcb777be1fbd -r a9a10a43a670 usr.bin/ftp/fetch.c
--- a/usr.bin/ftp/fetch.c       Wed Jul 04 01:08:57 2012 +0000
+++ b/usr.bin/ftp/fetch.c       Wed Jul 04 06:09:37 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fetch.c,v 1.197 2012/02/24 19:53:31 apb Exp $  */
+/*     $NetBSD: fetch.c,v 1.198 2012/07/04 06:09:37 is Exp $   */
 
 /*-
  * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.197 2012/02/24 19:53:31 apb Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.198 2012/07/04 06:09:37 is Exp $");
 #endif /* not lint */
 
 /*
@@ -734,7 +734,8 @@
                                continue;
                        }
 
-                       if (ftp_connect(s, res->ai_addr, res->ai_addrlen) < 0) {
+                       if (ftp_connect(s, res->ai_addr, res->ai_addrlen,
+                           verbose || !res->ai_next) < 0) {
                                close(s);
                                s = -1;
                                continue;
diff -r dcb777be1fbd -r a9a10a43a670 usr.bin/ftp/ftp.c
--- a/usr.bin/ftp/ftp.c Wed Jul 04 01:08:57 2012 +0000
+++ b/usr.bin/ftp/ftp.c Wed Jul 04 06:09:37 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ftp.c,v 1.163 2011/12/10 05:53:58 lukem Exp $  */
+/*     $NetBSD: ftp.c,v 1.164 2012/07/04 06:09:37 is Exp $     */
 
 /*-
  * Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
@@ -92,7 +92,7 @@
 #if 0
 static char sccsid[] = "@(#)ftp.c      8.6 (Berkeley) 10/27/94";
 #else
-__RCSID("$NetBSD: ftp.c,v 1.163 2011/12/10 05:53:58 lukem Exp $");
+__RCSID("$NetBSD: ftp.c,v 1.164 2012/07/04 06:09:37 is Exp $");
 #endif
 #endif /* not lint */
 
@@ -208,7 +208,8 @@
                            hname, sname);
                        continue;
                }
-               if (ftp_connect(s, res->ai_addr, res->ai_addrlen) < 0) {
+               if (ftp_connect(s, res->ai_addr, res->ai_addrlen,
+                   verbose || !res->ai_next) < 0) {
                        close(s);
                        s = -1;
                        continue;
@@ -1468,7 +1469,7 @@
                        goto bad;
 
                if (ftp_connect(data, (struct sockaddr *)&data_addr.si_su,
-                   data_addr.su_len) < 0) {
+                   data_addr.su_len, 1) < 0) {
                        if (activefallback) {
                                (void)close(data);
                                data = -1;
diff -r dcb777be1fbd -r a9a10a43a670 usr.bin/ftp/util.c
--- a/usr.bin/ftp/util.c        Wed Jul 04 01:08:57 2012 +0000
+++ b/usr.bin/ftp/util.c        Wed Jul 04 06:09:37 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: util.c,v 1.156 2011/12/10 05:53:58 lukem Exp $ */
+/*     $NetBSD: util.c,v 1.157 2012/07/04 06:09:37 is Exp $    */
 
 /*-
  * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: util.c,v 1.156 2011/12/10 05:53:58 lukem Exp $");
+__RCSID("$NetBSD: util.c,v 1.157 2012/07/04 06:09:37 is Exp $");
 #endif /* not lint */
 
 /*
@@ -1351,7 +1351,7 @@
  * error message displayed.)
  */
 int
-ftp_connect(int sock, const struct sockaddr *name, socklen_t namelen)
+ftp_connect(int sock, const struct sockaddr *name, socklen_t namelen, int pe)
 {
        int             flags, rv, timeout, error;
        socklen_t       slen;
@@ -1417,8 +1417,9 @@
        rv = connect(sock, name, namelen);      /* inititate the connection */
        if (rv == -1) {                         /* connection error */
                if (errno != EINPROGRESS) {     /* error isn't "please wait" */
+                       if (pe || (errno != EHOSTUNREACH))
  connecterror:
-                       warn("Can't connect to `%s:%s'", hname, sname);
+                               warn("Can't connect to `%s:%s'", hname, sname);
                        return -1;
                }
 



Home | Main Index | Thread Index | Old Index