Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- server/red-common.h | 1 + server/reds.c | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/server/red-common.h b/server/red-common.h index 181ed283..6b5d0b2e 100644 --- a/server/red-common.h +++ b/server/red-common.h @@ -35,6 +35,7 @@ #include "spice.h" #include "utils.h" +#include "sys-socket.h" #define SPICE_UPCAST(type, ptr) \ (verify_expr(SPICE_OFFSETOF(type, base) == 0,SPICE_CONTAINEROF(ptr, type, base))) diff --git a/server/reds.c b/server/reds.c index 3f1a4a05..b17dc208 100644 --- a/server/reds.c +++ b/server/reds.c @@ -106,6 +106,7 @@ static void adapter_timer_remove(const SpiceCoreInterfaceInternal *iface, SpiceT static SpiceWatch *adapter_watch_add(const SpiceCoreInterfaceInternal *iface, int fd, int event_mask, SpiceWatchFunc func, void *opaque) { + // note: Qemu API is fine having a SOCKET on Windows return iface->public_interface->watch_add(fd, event_mask, func, opaque); } @@ -2659,7 +2660,7 @@ static int reds_init_socket(const char *addr, int portnr, int family) len = SUN_LEN(&local); if (bind(slisten, (struct sockaddr *)&local, len) == -1) { perror("bind"); - close(slisten); + socket_close(slisten); return -1; } @@ -2707,7 +2708,7 @@ static int reds_init_socket(const char *addr, int portnr, int family) freeaddrinfo(res); goto listen; } - close(slisten); + socket_close(slisten); } spice_warning("binding socket to %s:%d failed", addr, portnr); freeaddrinfo(res); @@ -2716,7 +2717,7 @@ static int reds_init_socket(const char *addr, int portnr, int family) listen: if (listen(slisten, SOMAXCONN) != 0) { spice_warning("listen: %s", strerror(errno)); - close(slisten); + socket_close(slisten); return -1; } return slisten; @@ -2754,14 +2755,14 @@ static void reds_cleanup_net(SpiceServer *reds) if (reds->listen_socket != -1) { reds_core_watch_remove(reds, reds->listen_watch); if (reds->config->spice_listen_socket_fd != reds->listen_socket) { - close(reds->listen_socket); + socket_close(reds->listen_socket); } reds->listen_watch = NULL; reds->listen_socket = -1; } if (reds->secure_listen_socket != -1) { reds_core_watch_remove(reds, reds->secure_listen_watch); - close(reds->secure_listen_socket); + socket_close(reds->secure_listen_socket); reds->secure_listen_watch = NULL; reds->secure_listen_socket = -1; } -- 2.20.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel