git: 85f15576b423 - main - fetch(1): more fixes for soft failure handling

From: Eugene Grosbein <eugen_at_FreeBSD.org>
Date: Tue, 25 Jan 2022 05:48:50 UTC
The branch main has been updated by eugen:

URL: https://cgit.FreeBSD.org/src/commit/?id=85f15576b423b9ad5b8a9e6dab3e71558ebe4335

commit 85f15576b423b9ad5b8a9e6dab3e71558ebe4335
Author:     Eugene Grosbein <eugen@FreeBSD.org>
AuthorDate: 2022-01-25 05:46:07 +0000
Commit:     Eugene Grosbein <eugen@FreeBSD.org>
CommitDate: 2022-01-25 05:48:28 +0000

    fetch(1): more fixes for soft failure handling
    
    Fix logic error introduced in my commit
    bf599c03f09dea0f7e188e002b42d782af6841c3
    
    Also, authorization errors should not be considered as soft failures.
---
 usr.bin/fetch/fetch.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
index 65ba091e3334..73ee96541859 100644
--- a/usr.bin/fetch/fetch.c
+++ b/usr.bin/fetch/fetch.c
@@ -1200,17 +1200,18 @@ main(int argc, char *argv[])
 		if (e) {
 			r = 1;
 			if ((fetchLastErrCode
+			    && fetchLastErrCode != FETCH_AUTH
 			    && fetchLastErrCode != FETCH_UNAVAIL
 			    && fetchLastErrCode != FETCH_MOVED
 			    && fetchLastErrCode != FETCH_URL
 			    && fetchLastErrCode != FETCH_RESOLV
 			    && fetchLastErrCode != FETCH_UNKNOWN
-			    && (is_http
-			    	&& fetchLastErrCode != FETCH_PROTO
+			    && (!is_http || (
+			    	   fetchLastErrCode != FETCH_PROTO
 			    	&& fetchLastErrCode != FETCH_SERVER
 			    	&& fetchLastErrCode != FETCH_TEMP
 			    	&& fetchLastErrCode != FETCH_TIMEOUT
-			    ))) {
+			    )))) {
 				if (w_secs && v_level)
 					fprintf(stderr, "Waiting %ld seconds "
 					    "before retrying\n", w_secs);