[PATCH] Enable ConnectTimeout with ConnectionAttempts

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

 



Fix bug ConnectTimeout=N only works on the first ConnectionAttempts
https://bugzilla.mindrot.org/show_bug.cgi?id=2918
---
 sshconnect.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sshconnect.c b/sshconnect.c
index 4862da5e..b837a83a 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -454,11 +454,12 @@ waitrfd(int fd, int *timeoutp)
 {
 	struct pollfd pfd;
 	struct timeval t_start;
-	int oerrno, r;
+	int oerrno, r, next_timeout;
 
 	monotime_tv(&t_start);
 	pfd.fd = fd;
 	pfd.events = POLLIN;
+	next_timeout = *timeoutp;
 	for (; *timeoutp >= 0;) {
 		r = poll(&pfd, 1, *timeoutp);
 		oerrno = errno;
@@ -473,6 +474,7 @@ waitrfd(int fd, int *timeoutp)
 	}
 	/* timeout */
 	errno = ETIMEDOUT;
+	*timeoutp = next_timeout;
 	return -1;
 }
 
-- 
2.19.2

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev



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

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux