wininet: Directly return error status from NETCON_connect.

This commit is contained in:
Jacek Caban 2009-11-30 00:12:59 +01:00 committed by Alexandre Julliard
parent cff77d602c
commit bf1da4c857
3 changed files with 7 additions and 9 deletions

View File

@ -4361,8 +4361,9 @@ static BOOL HTTP_OpenConnection(http_request_t *lpwhr)
goto lend;
}
if (!NETCON_connect(&lpwhr->netConnection, (struct sockaddr *)&lpwhs->socketAddress,
lpwhs->sa_len))
res = NETCON_connect(&lpwhr->netConnection, (struct sockaddr *)&lpwhs->socketAddress,
lpwhs->sa_len);
if(res != ERROR_SUCCESS)
goto lend;
if (lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE)

View File

@ -433,7 +433,7 @@ void NETCON_unload(void);
DWORD NETCON_create(WININET_NETCONNECTION *connection, int domain,
int type, int protocol);
BOOL NETCON_close(WININET_NETCONNECTION *connection);
BOOL NETCON_connect(WININET_NETCONNECTION *connection, const struct sockaddr *serv_addr,
DWORD NETCON_connect(WININET_NETCONNECTION *connection, const struct sockaddr *serv_addr,
unsigned int addrlen);
BOOL NETCON_secure_connect(WININET_NETCONNECTION *connection, LPCWSTR hostname);
BOOL NETCON_send(WININET_NETCONNECTION *connection, const void *msg, size_t len, int flags,

View File

@ -532,25 +532,22 @@ fail:
* NETCON_connect
* Connects to the specified address.
*/
BOOL NETCON_connect(WININET_NETCONNECTION *connection, const struct sockaddr *serv_addr,
DWORD NETCON_connect(WININET_NETCONNECTION *connection, const struct sockaddr *serv_addr,
unsigned int addrlen)
{
int result;
if (!NETCON_connected(connection)) return FALSE;
result = connect(connection->socketFD, serv_addr, addrlen);
if (result == -1)
{
WARN("Unable to connect to host (%s)\n", strerror(errno));
INTERNET_SetLastError(sock_get_error(errno));
closesocket(connection->socketFD);
connection->socketFD = -1;
return FALSE;
return sock_get_error(errno);
}
return TRUE;
return ERROR_SUCCESS;
}
/******************************************************************************