git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Only print an error for the last connect() failure
@ 2011-06-09 16:18 Dave Zarzycki
  2011-06-09 16:33 ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Dave Zarzycki @ 2011-06-09 16:18 UTC (permalink / raw)
  To: git

IPv6 hosts are often unreachable on the primarily IPv4 Internet and
therefore we shouldn't print an error if there are still other hosts we
can try to connect() to. This helps "git fetch --quiet" stay quiet.
---
 connect.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/connect.c b/connect.c
index 2119c3f..7f70ce7 100644
--- a/connect.c
+++ b/connect.c
@@ -225,11 +225,13 @@ static int git_tcp_connect_sock(char *host, int flags)
 		}
 		if (connect(sockfd, ai->ai_addr, ai->ai_addrlen) < 0) {
 			saved_errno = errno;
-			fprintf(stderr, "%s[%d: %s]: errno=%s\n",
-				host,
-				cnt,
-				ai_name(ai),
-				strerror(saved_errno));
+			if (ai->ai_next == NULL) {
+				fprintf(stderr, "%s[%d: %s]: errno=%s\n",
+					host,
+					cnt,
+					ai_name(ai),
+					strerror(saved_errno));
+			}
 			close(sockfd);
 			sockfd = -1;
 			continue;
-- 
1.7.6.rc1.1.g2e27

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-06-09 17:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-09 16:18 [PATCH] Only print an error for the last connect() failure Dave Zarzycki
2011-06-09 16:33 ` Jeff King
2011-06-09 16:49   ` Dave Zarzycki
2011-06-09 17:05     ` Jeff King
2011-06-09 17:30     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).