summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-01-29 21:02:02 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-01-29 21:02:07 +0100
commit20fa0c3772c9ae14d68176a90da82ae26488c1f8 (patch)
treef9c157c8e2545d8a904db41fd9a5da3e9995ff6b
parent7adc08be69ff9c0f94a23444ab6f60dae14be385 (diff)
downloadgnutls-20fa0c3772c9ae14d68176a90da82ae26488c1f8.tar.gz
Corrected issue in gnutls-cli-debug which tried connections to multiple hosts.
gnutls-cli-debug was trying to connect to all possible IP addresses of the host and failed if any was unavailable. Now it tries sequentially and accepts the first that is working. Reported by Daniel Kahn Gillmor.
-rw-r--r--src/cli-debug.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cli-debug.c b/src/cli-debug.c
index 2cd2203edc..95c33f1603 100644
--- a/src/cli-debug.c
+++ b/src/cli-debug.c
@@ -267,14 +267,15 @@ main (int argc, char **argv)
getnameinfo (ptr->ai_addr, ptr->ai_addrlen, buffer, MAX_BUF,
NULL, 0, NI_NUMERICHOST);
- if (tt++ == 0)
- printf ("Connecting to '%s:%d'...\n", buffer, port);
+ printf ("Connecting to '%s:%d'...\n", buffer, port);
if ((err = connect (sd, ptr->ai_addr, ptr->ai_addrlen)) != 0)
{
close (sd);
sd = -1;
continue;
}
+ else
+ break;
}
ERR (err, "connect");