mirror of
https://github.com/reactos/wine.git
synced 2025-02-18 20:10:18 +00:00
wininet: Use WSAGetLastError in sock_get_error in Windows builds.
This commit is contained in:
parent
8efedaf045
commit
cafbd54457
dlls/wininet
@ -1239,7 +1239,7 @@ static DWORD FTPFILE_WriteFile(object_header_t *hdr, const void *buffer, DWORD s
|
||||
res = sock_send(lpwh->nDataSocket, buffer, size, 0);
|
||||
|
||||
*written = res>0 ? res : 0;
|
||||
return res >= 0 ? ERROR_SUCCESS : sock_get_error(errno);
|
||||
return res >= 0 ? ERROR_SUCCESS : sock_get_error();
|
||||
}
|
||||
|
||||
static void FTP_ReceiveRequestData(ftp_file_t *file, BOOL first_notif)
|
||||
|
@ -459,7 +459,7 @@ BOOL NETCON_is_alive(netconn_t*) DECLSPEC_HIDDEN;
|
||||
LPCVOID NETCON_GetCert(netconn_t *connection) DECLSPEC_HIDDEN;
|
||||
int NETCON_GetCipherStrength(netconn_t*) DECLSPEC_HIDDEN;
|
||||
DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value) DECLSPEC_HIDDEN;
|
||||
int sock_get_error(int) DECLSPEC_HIDDEN;
|
||||
int sock_get_error(void) DECLSPEC_HIDDEN;
|
||||
int sock_send(int fd, const void *msg, size_t len, int flags) DECLSPEC_HIDDEN;
|
||||
int sock_recv(int fd, void *msg, size_t len, int flags) DECLSPEC_HIDDEN;
|
||||
|
||||
|
@ -328,7 +328,7 @@ static DWORD create_netconn_socket(server_t *server, netconn_t *netconn, DWORD t
|
||||
result = connect(netconn->socket, (struct sockaddr*)&server->addr, server->addr_len);
|
||||
if(result == -1)
|
||||
{
|
||||
if (sock_get_error(errno) == WSAEINPROGRESS) {
|
||||
if (sock_get_error() == WSAEINPROGRESS) {
|
||||
struct pollfd pfd;
|
||||
int res;
|
||||
|
||||
@ -442,10 +442,12 @@ void NETCON_unload(void)
|
||||
}
|
||||
|
||||
/* translate a unix error code into a winsock one */
|
||||
int sock_get_error( int err )
|
||||
int sock_get_error(void)
|
||||
{
|
||||
#if !defined(__MINGW32__) && !defined (_MSC_VER)
|
||||
switch (err)
|
||||
#if defined(__MINGW32__) || defined(_MSC_VER)
|
||||
return WSAGetLastError();
|
||||
#else
|
||||
switch (errno)
|
||||
{
|
||||
case EINTR: return WSAEINTR;
|
||||
case EBADF: return WSAEBADF;
|
||||
@ -502,10 +504,9 @@ int sock_get_error( int err )
|
||||
#ifdef EREMOTE
|
||||
case EREMOTE: return WSAEREMOTE;
|
||||
#endif
|
||||
default: errno=err; perror("sock_set_error"); return WSAEFAULT;
|
||||
default: perror("sock_get_error"); return WSAEFAULT;
|
||||
}
|
||||
#endif
|
||||
return err;
|
||||
}
|
||||
|
||||
int sock_send(int fd, const void *msg, size_t len, int flags)
|
||||
@ -771,9 +772,7 @@ DWORD NETCON_send(netconn_t *connection, const void *msg, size_t len, int flags,
|
||||
if(!connection->secure)
|
||||
{
|
||||
*sent = sock_send(connection->socket, msg, len, flags);
|
||||
if (*sent == -1)
|
||||
return sock_get_error(errno);
|
||||
return ERROR_SUCCESS;
|
||||
return *sent == -1 ? sock_get_error() : ERROR_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -948,7 +947,7 @@ DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, blocking_mode_t
|
||||
|
||||
set_socket_blocking(connection->socket, mode);
|
||||
*recvd = sock_recv(connection->socket, buf, len, flags);
|
||||
return *recvd == -1 ? sock_get_error(errno) : ERROR_SUCCESS;
|
||||
return *recvd == -1 ? sock_get_error() : ERROR_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1103,8 +1102,8 @@ DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value)
|
||||
sizeof(tv));
|
||||
if (result == -1)
|
||||
{
|
||||
WARN("setsockopt failed (%s)\n", strerror(errno));
|
||||
return sock_get_error(errno);
|
||||
WARN("setsockopt failed\n");
|
||||
return sock_get_error();
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user