From 64ab1ddb13763640a589616730cc7e5106947b30 Mon Sep 17 00:00:00 2001 From: lukem Date: Tue, 20 Jul 2004 11:22:27 +0000 Subject: [PATCH] Don't unnecessarily display a 401/407 error when running with -V. Fix from PR [bin/18535] by Jeremy Reed. --- usr.bin/ftp/fetch.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/usr.bin/ftp/fetch.c b/usr.bin/ftp/fetch.c index f7d2bbdfadf9..06fc5a382743 100644 --- a/usr.bin/ftp/fetch.c +++ b/usr.bin/ftp/fetch.c @@ -1,4 +1,4 @@ -/* $NetBSD: fetch.c,v 1.148 2004/07/20 10:40:21 lukem Exp $ */ +/* $NetBSD: fetch.c,v 1.149 2004/07/20 11:22:27 lukem Exp $ */ /*- * Copyright (c) 1997-2004 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #include #ifndef lint -__RCSID("$NetBSD: fetch.c,v 1.148 2004/07/20 10:40:21 lukem Exp $"); +__RCSID("$NetBSD: fetch.c,v 1.149 2004/07/20 11:22:27 lukem Exp $"); #endif /* not lint */ /* @@ -1012,12 +1012,6 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth) char **authp; char *auser, *apass; - fprintf(ttyout, "%s\n", message); - if (EMPTYSTRING(auth)) { - warnx( - "No authentication challenge provided by server"); - goto cleanup_fetch_url; - } if (hcode == 401) { authp = &wwwauth; auser = user; @@ -1027,6 +1021,14 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth) auser = puser; apass = ppass; } + if (verbose || *authp == NULL || + auser == NULL || apass == NULL) + fprintf(ttyout, "%s\n", message); + if (EMPTYSTRING(auth)) { + warnx( + "No authentication challenge provided by server"); + goto cleanup_fetch_url; + } if (*authp != NULL) { char reply[10];