As discussed on tech-net@: Don't display expected EHOSTUNREACH for all but

the last connect attempts in terse mode.
This commit is contained in:
is 2012-07-04 06:09:37 +00:00
parent a3e3a29e66
commit 706521afb9
4 changed files with 16 additions and 13 deletions

View File

@ -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);

View File

@ -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 *proxyenv, char *proxyauth, char *wwwauth)
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;

View File

@ -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 *port)
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;

View File

@ -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 buflen, const char **errormsg)
* 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 sockaddr *name, socklen_t namelen)
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;
}