mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-04 00:06:29 +00:00
reds: Use socket compatibility layer (close -> socket_close)
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
This commit is contained in:
parent
026fab1825
commit
14d4cdebc3
@ -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)))
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user