Module Name: src
Committed By: is
Date: Wed Jul 4 06:09:38 UTC 2012
Modified Files:
src/usr.bin/ftp: extern.h fetch.c ftp.c util.c
Log Message:
As discussed on tech-net@: Don't display expected EHOSTUNREACH for all but
the last connect attempts in terse mode.
To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/usr.bin/ftp/extern.h
cvs rdiff -u -r1.197 -r1.198 src/usr.bin/ftp/fetch.c
cvs rdiff -u -r1.163 -r1.164 src/usr.bin/ftp/ftp.c
cvs rdiff -u -r1.156 -r1.157 src/usr.bin/ftp/util.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/ftp/extern.h
diff -u src/usr.bin/ftp/extern.h:1.79 src/usr.bin/ftp/extern.h:1.80
--- src/usr.bin/ftp/extern.h:1.79 Fri Sep 16 15:39:26 2011
+++ src/usr.bin/ftp/extern.h Wed Jul 4 06:09:37 2012
@@ -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 unsetoption(int, char **);
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);
Index: src/usr.bin/ftp/fetch.c
diff -u src/usr.bin/ftp/fetch.c:1.197 src/usr.bin/ftp/fetch.c:1.198
--- src/usr.bin/ftp/fetch.c:1.197 Fri Feb 24 19:53:31 2012
+++ src/usr.bin/ftp/fetch.c Wed Jul 4 06:09:37 2012
@@ -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 @@ fetch_url(const char *url, const char *p
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;
Index: src/usr.bin/ftp/ftp.c
diff -u src/usr.bin/ftp/ftp.c:1.163 src/usr.bin/ftp/ftp.c:1.164
--- src/usr.bin/ftp/ftp.c:1.163 Sat Dec 10 05:53:58 2011
+++ src/usr.bin/ftp/ftp.c Wed Jul 4 06:09:37 2012
@@ -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 @@ hookup(const char *host, const char *por
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 @@ initconn(void)
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;
Index: src/usr.bin/ftp/util.c
diff -u src/usr.bin/ftp/util.c:1.156 src/usr.bin/ftp/util.c:1.157
--- src/usr.bin/ftp/util.c:1.156 Sat Dec 10 05:53:58 2011
+++ src/usr.bin/ftp/util.c Wed Jul 4 06:09:37 2012
@@ -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 @@ get_line(FILE *stream, char *buf, size_t
* 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 @@ ftp_connect(int sock, const struct socka
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;
}