Commit 440ef7a1 authored by Steve Lhomme's avatar Steve Lhomme
Browse files

core: ensure getsockopt/setsockopt use the proper pointer size on Windows

Unlike most UNIX calls [1] on Windows many calls expect a BOOL instead of an
int [2]. It should be the same size, but make sure this is the case when
building.

We don't seem to use any of the options with a DWORD, LINGER or Service
Provider values.

[1] https://www.man7.org/linux/man-pages/man7/socket.7.html
[2] https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-setsockopt
parent ab8f0e57
Pipeline #20078 failed with stages
in 24 minutes and 14 seconds
......@@ -74,6 +74,10 @@ int net_Socket (vlc_object_t *p_this, int family, int socktype,
return -1;
}
#ifdef _WIN32
// Windows expects a BOOL for some getsockopt/setsockopt options
static_assert(sizeof(int)==sizeof(BOOL), "mismatching type for setsockopt");
#endif
setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, &(int){ 1 }, sizeof (int));
#ifdef IPV6_V6ONLY
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment