summaryrefslogtreecommitdiff
path: root/sshconnect.c
diff options
context:
space:
mode:
Diffstat (limited to 'sshconnect.c')
-rw-r--r--sshconnect.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sshconnect.c b/sshconnect.c
index 80b45c79e..dfeddd39e 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: sshconnect.c,v 1.155 2003/12/09 21:53:37 markus Exp $"); 16RCSID("$OpenBSD: sshconnect.c,v 1.156 2004/01/25 03:49:09 djm Exp $");
17 17
18#include <openssl/bn.h> 18#include <openssl/bn.h>
19 19
@@ -231,12 +231,12 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr,
231 if (timeout <= 0) 231 if (timeout <= 0)
232 return (connect(sockfd, serv_addr, addrlen)); 232 return (connect(sockfd, serv_addr, addrlen));
233 233
234 if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0) 234 set_nonblock(sockfd);
235 return (-1);
236
237 rc = connect(sockfd, serv_addr, addrlen); 235 rc = connect(sockfd, serv_addr, addrlen);
238 if (rc == 0) 236 if (rc == 0) {
237 unset_nonblock(sockfd);
239 return (0); 238 return (0);
239 }
240 if (errno != EINPROGRESS) 240 if (errno != EINPROGRESS)
241 return (-1); 241 return (-1);
242 242
@@ -277,6 +277,7 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr,
277 break; 277 break;
278 } 278 }
279 result = 0; 279 result = 0;
280 unset_nonblock(sockfd);
280 break; 281 break;
281 default: 282 default:
282 /* Should not occur */ 283 /* Should not occur */