Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
587732ac
Commit
587732ac
authored
Jul 27, 2020
by
Alistair Leslie-Hughes
Committed by
Alexandre Julliard
Jul 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Correct returned error code for an invalid socket.
Signed-off-by:
Alistair Leslie-Hughes
<
leslie_alistair@hotmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
046475d8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
30 deletions
+9
-30
socket.c
dlls/ws2_32/socket.c
+7
-25
sock.c
dlls/ws2_32/tests/sock.c
+2
-5
No files found.
dlls/ws2_32/socket.c
View file @
587732ac
...
...
@@ -1119,8 +1119,8 @@ static DWORD NtStatusToWSAError( DWORD status )
{
case
STATUS_SUCCESS
:
return
0
;
case
STATUS_PENDING
:
return
WSA_IO_PENDING
;
case
STATUS_INVALID_HANDLE
:
case
STATUS_OBJECT_TYPE_MISMATCH
:
return
WSAENOTSOCK
;
case
STATUS_INVALID_HANDLE
:
return
WSAEBADF
;
case
STATUS_INVALID_PARAMETER
:
return
WSAEINVAL
;
case
STATUS_PIPE_DISCONNECTED
:
return
WSAESHUTDOWN
;
case
STATUS_NETWORK_BUSY
:
return
WSAEALREADY
;
...
...
@@ -2889,19 +2889,11 @@ static BOOL WINAPI WS2_AcceptEx(SOCKET listener, SOCKET acceptor, PVOID dest, DW
}
fd
=
get_sock_fd
(
listener
,
FILE_READ_DATA
,
NULL
);
if
(
fd
==
-
1
)
{
SetLastError
(
WSAENOTSOCK
);
return
FALSE
;
}
if
(
fd
==
-
1
)
return
FALSE
;
release_sock_fd
(
listener
,
fd
);
fd
=
get_sock_fd
(
acceptor
,
FILE_READ_DATA
,
NULL
);
if
(
fd
==
-
1
)
{
SetLastError
(
WSAENOTSOCK
);
return
FALSE
;
}
if
(
fd
==
-
1
)
return
FALSE
;
release_sock_fd
(
acceptor
,
fd
);
wsa
=
(
struct
ws2_accept_async
*
)
alloc_async_io
(
sizeof
(
*
wsa
),
WS2_async_accept
);
...
...
@@ -3147,11 +3139,8 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
buffers
,
flags
);
fd
=
get_sock_fd
(
s
,
FILE_WRITE_DATA
,
NULL
);
if
(
fd
==
-
1
)
{
WSASetLastError
(
WSAENOTSOCK
);
return
FALSE
;
}
if
(
fd
==
-
1
)
return
FALSE
;
if
(
getpeername
(
fd
,
&
uaddr
.
addr
,
&
uaddrlen
)
!=
0
)
{
release_sock_fd
(
s
,
fd
);
...
...
@@ -3497,8 +3486,6 @@ int WINAPI WS_closesocket(SOCKET s)
if
(
CloseHandle
(
SOCKET2HANDLE
(
s
)))
res
=
0
;
}
else
SetLastError
(
WSAENOTSOCK
);
}
else
SetLastError
(
WSANOTINITIALISED
);
...
...
@@ -3609,11 +3596,7 @@ static BOOL WINAPI WS2_ConnectEx(SOCKET s, const struct WS_sockaddr* name, int n
}
fd
=
get_sock_fd
(
s
,
FILE_READ_DATA
,
NULL
);
if
(
fd
==
-
1
)
{
SetLastError
(
WSAENOTSOCK
);
return
FALSE
;
}
if
(
fd
==
-
1
)
return
FALSE
;
TRACE
(
"socket %04lx, ptr %p %s, length %d, sendptr %p, len %d, ov %p
\n
"
,
s
,
name
,
debugstr_sockaddr
(
name
),
namelen
,
sendBuf
,
sendBufLen
,
ov
);
...
...
@@ -5207,8 +5190,7 @@ int WINAPI WS_listen(SOCKET s, int backlog)
SetLastError
(
wsaErrno
());
release_sock_fd
(
s
,
fd
);
}
else
SetLastError
(
WSAENOTSOCK
);
return
ret
;
}
...
...
dlls/ws2_32/tests/sock.c
View file @
587732ac
...
...
@@ -1565,7 +1565,6 @@ todo_wine
size
=
sizeof
(
i
);
i
=
1234
;
err
=
getsockopt
(
s
,
SOL_SOCKET
,
SO_ERROR
,
(
char
*
)
&
i
,
&
size
);
todo_wine
ok
(
(
err
==
SOCKET_ERROR
)
&&
(
WSAGetLastError
()
==
WSAENOTSOCK
),
"got %d with %d (expected SOCKET_ERROR with WSAENOTSOCK)
\n
"
,
err
,
WSAGetLastError
());
...
...
@@ -3850,8 +3849,7 @@ static void test_select(void)
SetLastError
(
0xdeadbeef
);
ret
=
select
(
0
,
&
readfds
,
NULL
,
&
exceptfds
,
&
select_timeout
);
ok
(
ret
==
SOCKET_ERROR
,
"expected -1, got %d
\n
"
,
ret
);
todo_wine
ok
(
GetLastError
()
==
WSAENOTSOCK
,
"expected 10038, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
WSAENOTSOCK
,
"got %d
\n
"
,
GetLastError
());
/* descriptor sets are unchanged */
ok
(
readfds
.
fd_count
==
2
,
"expected 2, got %d
\n
"
,
readfds
.
fd_count
);
ok
(
exceptfds
.
fd_count
==
2
,
"expected 2, got %d
\n
"
,
exceptfds
.
fd_count
);
...
...
@@ -3878,8 +3876,7 @@ todo_wine
ret
=
select
(
0
,
NULL
,
NULL
,
&
exceptfds
,
&
select_timeout
);
todo_wine
ok
(
ret
==
SOCKET_ERROR
,
"expected -1, got %d
\n
"
,
ret
);
todo_wine
ok
(
GetLastError
()
==
WSAENOTSOCK
,
"expected 10038, got %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
WSAENOTSOCK
,
"got %d
\n
"
,
GetLastError
());
WaitForSingleObject
(
thread_handle
,
1000
);
closesocket
(
fdRead
);
...
...
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