From f83c28f1b3f5556539ca68964e2a8d192c9f67c8 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Sun, 25 Jan 2004 03:49:10 +0000 Subject: reset nonblocking flag after ConnectTimeout > 0 connect; (bugzilla #785) from jclonguet AT free.fr; ok millert@ --- usr.bin/ssh/sshconnect.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/usr.bin/ssh/sshconnect.c b/usr.bin/ssh/sshconnect.c index f08e9591140..3b30dee811d 100644 --- a/usr.bin/ssh/sshconnect.c +++ b/usr.bin/ssh/sshconnect.c @@ -13,7 +13,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshconnect.c,v 1.155 2003/12/09 21:53:37 markus Exp $"); +RCSID("$OpenBSD: sshconnect.c,v 1.156 2004/01/25 03:49:09 djm Exp $"); #include @@ -227,12 +227,12 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr, if (timeout <= 0) return (connect(sockfd, serv_addr, addrlen)); - if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0) - return (-1); - + set_nonblock(sockfd); rc = connect(sockfd, serv_addr, addrlen); - if (rc == 0) + if (rc == 0) { + unset_nonblock(sockfd); return (0); + } if (errno != EINPROGRESS) return (-1); @@ -273,6 +273,7 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr, break; } result = 0; + unset_nonblock(sockfd); break; default: /* Should not occur */ -- cgit v1.2.3