wininet: Directly return error status from NETCON_create.

This commit is contained in:
Jacek Caban 2009-11-30 00:12:42 +01:00 committed by Alexandre Julliard
parent 510ed24f9a
commit cff77d602c
3 changed files with 13 additions and 11 deletions

View File

@ -4314,6 +4314,7 @@ static BOOL HTTP_OpenConnection(http_request_t *lpwhr)
appinfo_t *hIC = NULL;
char szaddr[INET6_ADDRSTRLEN];
const void *addr;
DWORD res = ERROR_SUCCESS;
TRACE("-->\n");
@ -4353,10 +4354,10 @@ static BOOL HTTP_OpenConnection(http_request_t *lpwhr)
szaddr,
strlen(szaddr)+1);
if (!NETCON_create(&lpwhr->netConnection, lpwhs->socketAddress.ss_family,
SOCK_STREAM, 0))
res = NETCON_create(&lpwhr->netConnection, lpwhs->socketAddress.ss_family, SOCK_STREAM, 0);
if (res != ERROR_SUCCESS)
{
WARN("Socket creation failed: %u\n", INTERNET_GetLastError());
WARN("Socket creation failed: %u\n", res);
goto lend;
}
@ -4392,6 +4393,9 @@ lend:
lpwhr->read_pos = lpwhr->read_size = 0;
lpwhr->read_chunked = FALSE;
if(res != ERROR_SUCCESS)
INTERNET_SetLastError(res);
TRACE("%d <--\n", bSuccess);
return bSuccess;
}

View File

@ -430,7 +430,7 @@ VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext,
BOOL NETCON_connected(WININET_NETCONNECTION *connection);
BOOL NETCON_init(WININET_NETCONNECTION *connnection, BOOL useSSL);
void NETCON_unload(void);
BOOL NETCON_create(WININET_NETCONNECTION *connection, int domain,
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,

View File

@ -385,21 +385,19 @@ static int sock_get_error( int err )
* NETCON_create
* Basically calls 'socket()'
*/
BOOL NETCON_create(WININET_NETCONNECTION *connection, int domain,
DWORD NETCON_create(WININET_NETCONNECTION *connection, int domain,
int type, int protocol)
{
#ifdef SONAME_LIBSSL
if (connection->useSSL)
return FALSE;
return ERROR_NOT_SUPPORTED;
#endif
connection->socketFD = socket(domain, type, protocol);
if (connection->socketFD == -1)
{
INTERNET_SetLastError(sock_get_error(errno));
return FALSE;
}
return TRUE;
return sock_get_error(errno);
return ERROR_SUCCESS;
}
/******************************************************************************