[PATCH 4/6] transport: fix index in ipv6 connection failed message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]