Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
cafbd544
Commit
cafbd544
authored
Feb 11, 2015
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Use WSAGetLastError in sock_get_error in Windows builds.
parent
8efedaf0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
14 deletions
+13
-14
ftp.c
dlls/wininet/ftp.c
+1
-1
internet.h
dlls/wininet/internet.h
+1
-1
netconnection.c
dlls/wininet/netconnection.c
+11
-12
No files found.
dlls/wininet/ftp.c
View file @
cafbd544
...
@@ -1239,7 +1239,7 @@ static DWORD FTPFILE_WriteFile(object_header_t *hdr, const void *buffer, DWORD s
...
@@ -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
);
res
=
sock_send
(
lpwh
->
nDataSocket
,
buffer
,
size
,
0
);
*
written
=
res
>
0
?
res
:
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
)
static
void
FTP_ReceiveRequestData
(
ftp_file_t
*
file
,
BOOL
first_notif
)
...
...
dlls/wininet/internet.h
View file @
cafbd544
...
@@ -459,7 +459,7 @@ BOOL NETCON_is_alive(netconn_t*) DECLSPEC_HIDDEN;
...
@@ -459,7 +459,7 @@ BOOL NETCON_is_alive(netconn_t*) DECLSPEC_HIDDEN;
LPCVOID
NETCON_GetCert
(
netconn_t
*
connection
)
DECLSPEC_HIDDEN
;
LPCVOID
NETCON_GetCert
(
netconn_t
*
connection
)
DECLSPEC_HIDDEN
;
int
NETCON_GetCipherStrength
(
netconn_t
*
)
DECLSPEC_HIDDEN
;
int
NETCON_GetCipherStrength
(
netconn_t
*
)
DECLSPEC_HIDDEN
;
DWORD
NETCON_set_timeout
(
netconn_t
*
connection
,
BOOL
send
,
DWORD
value
)
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_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
;
int
sock_recv
(
int
fd
,
void
*
msg
,
size_t
len
,
int
flags
)
DECLSPEC_HIDDEN
;
...
...
dlls/wininet/netconnection.c
View file @
cafbd544
...
@@ -328,7 +328,7 @@ static DWORD create_netconn_socket(server_t *server, netconn_t *netconn, DWORD t
...
@@ -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
);
result
=
connect
(
netconn
->
socket
,
(
struct
sockaddr
*
)
&
server
->
addr
,
server
->
addr_len
);
if
(
result
==
-
1
)
if
(
result
==
-
1
)
{
{
if
(
sock_get_error
(
errno
)
==
WSAEINPROGRESS
)
{
if
(
sock_get_error
()
==
WSAEINPROGRESS
)
{
struct
pollfd
pfd
;
struct
pollfd
pfd
;
int
res
;
int
res
;
...
@@ -442,10 +442,12 @@ void NETCON_unload(void)
...
@@ -442,10 +442,12 @@ void NETCON_unload(void)
}
}
/* translate a unix error code into a winsock one */
/* 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)
#if defined(__MINGW32__) || defined(_MSC_VER)
switch
(
err
)
return
WSAGetLastError
();
#else
switch
(
errno
)
{
{
case
EINTR
:
return
WSAEINTR
;
case
EINTR
:
return
WSAEINTR
;
case
EBADF
:
return
WSAEBADF
;
case
EBADF
:
return
WSAEBADF
;
...
@@ -502,10 +504,9 @@ int sock_get_error( int err )
...
@@ -502,10 +504,9 @@ int sock_get_error( int err )
#ifdef EREMOTE
#ifdef EREMOTE
case
EREMOTE
:
return
WSAEREMOTE
;
case
EREMOTE
:
return
WSAEREMOTE
;
#endif
#endif
default:
errno
=
err
;
perror
(
"sock_s
et_error"
);
return
WSAEFAULT
;
default:
perror
(
"sock_g
et_error"
);
return
WSAEFAULT
;
}
}
#endif
#endif
return
err
;
}
}
int
sock_send
(
int
fd
,
const
void
*
msg
,
size_t
len
,
int
flags
)
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,
...
@@ -771,9 +772,7 @@ DWORD NETCON_send(netconn_t *connection, const void *msg, size_t len, int flags,
if
(
!
connection
->
secure
)
if
(
!
connection
->
secure
)
{
{
*
sent
=
sock_send
(
connection
->
socket
,
msg
,
len
,
flags
);
*
sent
=
sock_send
(
connection
->
socket
,
msg
,
len
,
flags
);
if
(
*
sent
==
-
1
)
return
*
sent
==
-
1
?
sock_get_error
()
:
ERROR_SUCCESS
;
return
sock_get_error
(
errno
);
return
ERROR_SUCCESS
;
}
}
else
else
{
{
...
@@ -948,7 +947,7 @@ DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, blocking_mode_t
...
@@ -948,7 +947,7 @@ DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, blocking_mode_t
set_socket_blocking
(
connection
->
socket
,
mode
);
set_socket_blocking
(
connection
->
socket
,
mode
);
*
recvd
=
sock_recv
(
connection
->
socket
,
buf
,
len
,
flags
);
*
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
else
{
{
...
@@ -1103,8 +1102,8 @@ DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value)
...
@@ -1103,8 +1102,8 @@ DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value)
sizeof
(
tv
));
sizeof
(
tv
));
if
(
result
==
-
1
)
if
(
result
==
-
1
)
{
{
WARN
(
"setsockopt failed
(%s)
\n
"
,
strerror
(
errno
)
);
WARN
(
"setsockopt failed
\n
"
);
return
sock_get_error
(
errno
);
return
sock_get_error
();
}
}
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment