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
70073ff2
Commit
70073ff2
authored
Nov 20, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Return a WSA error code in accept_socket.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
49babc0b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
26 deletions
+14
-26
socket.c
dlls/ws2_32/socket.c
+9
-10
sock.c
server/sock.c
+5
-16
No files found.
dlls/ws2_32/socket.c
View file @
70073ff2
...
...
@@ -2521,7 +2521,7 @@ static NTSTATUS WS2_async_accept( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS st
}
SERVER_END_REQ
;
if
(
status
==
STATUS_CANT_WAIT
)
if
(
NtStatusToWSAError
(
status
)
==
WSAEWOULDBLOCK
)
return
STATUS_PENDING
;
if
(
status
==
STATUS_INVALID_HANDLE
)
...
...
@@ -2760,9 +2760,9 @@ static int WS2_register_async_shutdown( SOCKET s, int type )
*/
SOCKET
WINAPI
WS_accept
(
SOCKET
s
,
struct
WS_sockaddr
*
addr
,
int
*
addrlen32
)
{
NTSTATUS
status
;
DWORD
err
;
SOCKET
as
;
int
fd
;
BOOL
is_blocking
;
TRACE
(
"socket %04lx
\n
"
,
s
);
...
...
@@ -2770,18 +2770,19 @@ SOCKET WINAPI WS_accept(SOCKET s, struct WS_sockaddr *addr, int *addrlen32)
if
(
err
)
goto
error
;
do
{
for
(;;)
{
/* try accepting first (if there is a deferred connection) */
SERVER_START_REQ
(
accept_socket
)
{
req
->
lhandle
=
wine_server_obj_handle
(
SOCKET2HANDLE
(
s
)
);
req
->
access
=
GENERIC_READ
|
GENERIC_WRITE
|
SYNCHRONIZE
;
req
->
attributes
=
OBJ_INHERIT
;
status
=
wine_server_call
(
req
);
err
=
NtStatusToWSAError
(
wine_server_call
(
req
)
);
as
=
HANDLE2SOCKET
(
wine_server_ptr_handle
(
reply
->
handle
));
}
SERVER_END_REQ
;
if
(
!
status
)
if
(
!
err
)
{
if
(
addr
&&
addrlen32
&&
WS_getpeername
(
as
,
addr
,
addrlen32
))
{
...
...
@@ -2791,16 +2792,14 @@ SOCKET WINAPI WS_accept(SOCKET s, struct WS_sockaddr *addr, int *addrlen32)
TRACE
(
"
\t
accepted %04lx
\n
"
,
as
);
return
as
;
}
if
(
is_blocking
&&
status
==
STATUS_CANT_WAIT
)
{
int
fd
=
get_sock_fd
(
s
,
FILE_READ_DATA
,
NULL
);
if
(
!
is_blocking
)
break
;
if
(
err
!=
WSAEWOULDBLOCK
)
break
;
fd
=
get_sock_fd
(
s
,
FILE_READ_DATA
,
NULL
);
/* block here */
do_block
(
fd
,
POLLIN
,
-
1
);
_sync_sock_state
(
s
);
/* let wineserver notice connection */
release_sock_fd
(
s
,
fd
);
}
}
while
(
is_blocking
&&
status
==
STATUS_CANT_WAIT
);
err
=
NtStatusToWSAError
(
status
);
error:
WARN
(
" -> ERROR %d
\n
"
,
err
);
...
...
server/sock.c
View file @
70073ff2
...
...
@@ -135,7 +135,6 @@ static void sock_reselect_async( struct fd *fd, struct async_queue *queue );
static
int
sock_get_ntstatus
(
int
err
);
static
unsigned
int
sock_get_error
(
int
err
);
static
void
sock_set_error
(
void
);
static
const
struct
object_ops
sock_ops
=
{
...
...
@@ -699,17 +698,13 @@ static int accept_new_fd( struct sock *sock )
* or that accept() is allowed on it. In those cases we will get -1/errno
* return.
*/
int
acceptfd
;
struct
sockaddr
saddr
;
socklen_t
slen
=
sizeof
(
saddr
);
acceptfd
=
accept
(
get_unix_fd
(
sock
->
fd
),
&
saddr
,
&
slen
);
if
(
acceptfd
==
-
1
)
{
sock_set_error
();
return
acceptfd
;
}
fcntl
(
acceptfd
,
F_SETFL
,
O_NONBLOCK
);
/* make socket nonblocking */
int
acceptfd
=
accept
(
get_unix_fd
(
sock
->
fd
),
&
saddr
,
&
slen
);
if
(
acceptfd
!=
-
1
)
fcntl
(
acceptfd
,
F_SETFL
,
O_NONBLOCK
);
else
set_win32_error
(
sock_get_error
(
errno
));
return
acceptfd
;
}
...
...
@@ -936,12 +931,6 @@ static int sock_get_ntstatus( int err )
}
}
/* set the last error depending on errno */
static
void
sock_set_error
(
void
)
{
set_error
(
sock_get_ntstatus
(
errno
)
);
}
#ifdef HAVE_LINUX_RTNETLINK_H
/* only keep one ifchange object around, all sockets waiting for wakeups will look to it */
...
...
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