diff --git a/Changelog b/Changelog index 2c33c97..15708d1 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ [Changes 1.2c01] +* Improve connect() error handling. (caf) + * Remove obsolete .spec files. (caf) * configure - only create sig.inc if it's actually needed. (caf) diff --git a/source/network.c b/source/network.c index fa968f9..e1ed12b 100644 --- a/source/network.c +++ b/source/network.c @@ -611,13 +611,10 @@ int BX_connect_by_number(char *hostn, unsigned short *portnum, int service, int } #endif alarm(get_int_var(CONNECT_TIMEOUT_VAR)); - if (connect (fd, (struct sockaddr *)&server, sizeof(server)) < 0) + if (connect(fd, (struct sockaddr *)&server, sizeof(server)) < 0 && errno != EINPROGRESS) { alarm(0); -#ifdef NON_BLOCKING_CONNECTS - if (!nonblocking) -#endif - return close(fd), -4; + return close(fd), -4; } alarm(0); }