summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sshconnect.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sshconnect.c b/sshconnect.c
index 955671b4e..eb5139fc7 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect.c,v 1.312 2019/01/24 17:00:29 dtucker Exp $ */ 1/* $OpenBSD: sshconnect.c,v 1.313 2019/02/01 03:52:23 dtucker Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -457,7 +457,7 @@ ssh_connect_direct(struct ssh *ssh, const char *host, struct addrinfo *aitop,
457 struct sockaddr_storage *hostaddr, u_short port, int family, 457 struct sockaddr_storage *hostaddr, u_short port, int family,
458 int connection_attempts, int *timeout_ms, int want_keepalive) 458 int connection_attempts, int *timeout_ms, int want_keepalive)
459{ 459{
460 int on = 1; 460 int on = 1, saved_timeout_ms = *timeout_ms;
461 int oerrno, sock = -1, attempt; 461 int oerrno, sock = -1, attempt;
462 char ntop[NI_MAXHOST], strport[NI_MAXSERV]; 462 char ntop[NI_MAXHOST], strport[NI_MAXSERV];
463 struct addrinfo *ai; 463 struct addrinfo *ai;
@@ -501,6 +501,7 @@ ssh_connect_direct(struct ssh *ssh, const char *host, struct addrinfo *aitop,
501 continue; 501 continue;
502 } 502 }
503 503
504 *timeout_ms = saved_timeout_ms;
504 if (timeout_connect(sock, ai->ai_addr, ai->ai_addrlen, 505 if (timeout_connect(sock, ai->ai_addr, ai->ai_addrlen,
505 timeout_ms) >= 0) { 506 timeout_ms) >= 0) {
506 /* Successful connection. */ 507 /* Successful connection. */