diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2004-01-25 03:49:10 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2004-01-25 03:49:10 +0000 |
commit | f83c28f1b3f5556539ca68964e2a8d192c9f67c8 (patch) | |
tree | 4c182327081a6d1434fa78dba6c5d00cbf9097db | |
parent | 385e1db12e3d8275120ee412a1c0a8d5377eaa17 (diff) |
reset nonblocking flag after ConnectTimeout > 0 connect; (bugzilla #785)
from jclonguet AT free.fr; ok millert@
-rw-r--r-- | usr.bin/ssh/sshconnect.c | 11 |
1 files 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 <openssl/bn.h> @@ -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 */ |