summaryrefslogtreecommitdiff
path: root/sshconnect.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2006-10-24 03:02:23 +1000
committerDamien Miller <djm@mindrot.org>2006-10-24 03:02:23 +1000
commitf4bcd10c4c9b53e7c0c2821825addaf3a13d7c1a (patch)
treef5057a64ea7acfc62d45457ec820ad7c042989b0 /sshconnect.c
parent990b1a80b59eb52ae401ed28b0e3a4d5a0963661 (diff)
- markus@cvs.openbsd.org 2006/10/10 10:12:45
[sshconnect.c] sleep before retrying (not after) since sleep changes errno; fixes pr 5250; rad@twig.com; ok dtucker djm
Diffstat (limited to 'sshconnect.c')
-rw-r--r--sshconnect.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sshconnect.c b/sshconnect.c
index a7a4e8a96..a222233d0 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect.c,v 1.199 2006/08/03 03:34:42 deraadt Exp $ */
+/* $OpenBSD: sshconnect.c,v 1.200 2006/10/10 10:12:45 markus Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -324,9 +324,11 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr,
gai_strerror(gaierr));
for (attempt = 0; attempt < connection_attempts; attempt++) {
- if (attempt > 0)
+ if (attempt > 0) {
+ /* Sleep a moment before retrying. */
+ sleep(1);
debug("Trying again...");
-
+ }
/*
* Loop through addresses for this host, and try each one in
* sequence until the connection succeeds.
@@ -363,9 +365,6 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr,
}
if (sock != -1)
break; /* Successful connection. */
-
- /* Sleep a moment before retrying. */
- sleep(1);
}
freeaddrinfo(aitop);