aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/socket_util.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/socket_util.c b/src/socket_util.c
index 7895d3367..0909765ba 100644
--- a/src/socket_util.c
+++ b/src/socket_util.c
@@ -111,8 +111,14 @@ socket_bind_listen(int domain, int type, int protocol,
return -1;
}
+#ifdef WIN32
+ const char *optval = (const char *)&reuse;
+#else
+ const void *optval = &reuse;
+#endif
+
ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
- &reuse, sizeof(reuse));
+ optval, sizeof(reuse));
if (ret < 0) {
g_set_error(error, listen_quark(), errno,
"setsockopt() failed: %s", g_strerror(errno));