git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Julien Cristau <jcristau@debian.org>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
	Ilari Liusvaara <ilari.liusvaara@elisanet.fi>,
	"Shawn O. Pearce" <spearce@spearce.org>
Subject: [PATCH 4/6] transport: fix index in ipv6 connection failed message
Date: Mon, 6 Jun 2011 04:40:54 -0500	[thread overview]
Message-ID: <20110606094054.GI8015@elie> (raw)
In-Reply-To: <20110606093019.GD8015@elie>

Ever since v1.5.3-rc0~185^2~1 (Verbose connect messages to show
the IP addresses used, 2007-05-23), git's ipv4 connection failure
messages have looked something like

	git.example.com[2: 127.0.0.1]: errno=Network Unreachable

The increasing index ("2" above) indicates which item in the list of
addresses returned by gethostbyname was being tried so the operator
can tell that git was not just trying to resolve the same hostname
again and again.

The ipv6 codepath prints something similar, but the counter is never
incremented so the index is always "0".  Fix it.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 tcp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tcp.c b/tcp.c
index 2cb90db..9916272 100644
--- a/tcp.c
+++ b/tcp.c
@@ -134,7 +134,7 @@ static int git_tcp_connect_sock(char *host, int flags)
 	const char *port = STR(DEFAULT_GIT_PORT);
 	struct addrinfo hints, *ai0, *ai;
 	int gai;
-	int cnt = 0;
+	int cnt;
 
 	get_host_and_port(&host, &port);
 	if (!*port)
@@ -154,7 +154,7 @@ static int git_tcp_connect_sock(char *host, int flags)
 	if (flags & CONNECT_VERBOSE)
 		fprintf(stderr, "done.\nConnecting to %s (port %s) ... ", host, port);
 
-	for (ai0 = ai; ai; ai = ai->ai_next) {
+	for (cnt = 0, ai0 = ai; ai; ai = ai->ai_next, cnt++) {
 		sockfd = socket(ai->ai_family,
 				ai->ai_socktype, ai->ai_protocol);
 		if (sockfd < 0) {
-- 
1.7.5.3

  parent reply	other threads:[~2011-06-06  9:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20110524202249.GA5889@elie>
     [not found] ` <20110524230900.GA9440@radis.liafa.jussieu.fr>
2011-06-06  9:30   ` [RFC/PATCH 0/6] git: please honor DNS SRV records Jonathan Nieder
2011-06-06  9:37     ` [PATCH 1/6] transport: expose git_tcp_connect and friends in new tcp.h Jonathan Nieder
2011-06-06  9:38     ` [PATCH 2/6] daemon: make host resolution into a separate function Jonathan Nieder
2011-06-06  9:39     ` [PATCH 3/6] daemon: move locate_host to tcp.c Jonathan Nieder
2011-06-06  9:40     ` Jonathan Nieder [this message]
2011-06-06  9:41     ` [PATCH 5/6] tcp: unify ipv4 and ipv6 code paths Jonathan Nieder
2011-06-06 10:01       ` Jonathan Nieder
2011-06-06  9:46     ` [PATCH 6/6] transport: learn to honor DNS SRV records Jonathan Nieder
2011-06-06  9:49     ` [RFC/PATCH 0/6] git: please " Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110606094054.GI8015@elie \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ilari.liusvaara@elisanet.fi \
    --cc=jcristau@debian.org \
    --cc=peff@peff.net \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).