Re: [PATCH spice-server v4 10/20] reds: Use socket compatibility layer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

All this patch does is replacing close(sock) with socket_close(sock),
which is defined a couple of patches earlier.
I'd change the subject to reflect that.


On 2/6/19 3:58 PM, Frediano Ziglio wrote:
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"

Is this needed ?


Other than that, looks good to me.

Uri.

#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 97023b38..3404d5a2 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -114,6 +114,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);
  }
@@ -2667,7 +2668,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;
          }
@@ -2715,7 +2716,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);
@@ -2724,7 +2725,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;
@@ -2762,14 +2763,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;
      }


_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]