Commit 6aa0f61e authored by Max Kellermann's avatar Max Kellermann

socket_util: fix setsockopt() argument type on WIN32

In the winsock headers, the setsockopt() argument is declared as "const char *", not "const void *".
parent 4461c3d5
...@@ -111,8 +111,14 @@ socket_bind_listen(int domain, int type, int protocol, ...@@ -111,8 +111,14 @@ socket_bind_listen(int domain, int type, int protocol,
return -1; return -1;
} }
#ifdef WIN32
const char *optval = (const char *)&reuse;
#else
const void *optval = &reuse;
#endif
ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
&reuse, sizeof(reuse)); optval, sizeof(reuse));
if (ret < 0) { if (ret < 0) {
g_set_error(error, listen_quark(), errno, g_set_error(error, listen_quark(), errno,
"setsockopt() failed: %s", g_strerror(errno)); "setsockopt() failed: %s", g_strerror(errno));
......
Markdown is supported
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