diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2007-12-28 23:27:45 +0000 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2007-12-28 23:27:45 +0000 | 
| commit | 6f7ac174bb8fbde5e07e1c7da3cf691ecb4e172b (patch) | |
| tree | 8971f6f8ff242ac75865cba5acac238c17f337c9 /lib/proxy.c | |
| parent | fb4ebcc5e3cffc4683cd3f38d7aba6cd86dbcd50 (diff) | |
Fixed return value check in proxy_connect(), since on some systems
a non-blocking connect() can return immediately (when connecting to
localhost, for example). Closes bug #233 and #340.
Diffstat (limited to 'lib/proxy.c')
| -rw-r--r-- | lib/proxy.c | 21 | 
1 files changed, 10 insertions, 11 deletions
| diff --git a/lib/proxy.c b/lib/proxy.c index dff5d0a4..0e1c8f07 100644 --- a/lib/proxy.c +++ b/lib/proxy.c @@ -129,18 +129,17 @@ static int proxy_connect_none(const char *host, unsigned short port, struct PHB  	event_debug("proxy_connect_none( \"%s\", %d ) = %d\n", host, port, fd); -	if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0) { -		if (sockerr_again()) { -			phb->inpa = b_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb); -			phb->fd = fd; -		} else { -			closesocket(fd); -			g_free(phb); -			return -1; -		} +	if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0 && !sockerr_again()) { +		closesocket(fd); +		g_free(phb); +		 +		return -1; +	} else { +		phb->inpa = b_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb); +		phb->fd = fd; +		 +		return fd;  	} - -	return fd;  } | 
