[Spice-devel] [PATCH spice-server v6 10/19] dispatcher: Use socket compatibility layer

Frediano Ziglio fziglio at redhat.com
Tue Apr 30 12:24:10 UTC 2019


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/dispatcher.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/server/dispatcher.c b/server/dispatcher.c
index 5204ddee..a1fb705c 100644
--- a/server/dispatcher.c
+++ b/server/dispatcher.c
@@ -113,8 +113,8 @@ dispatcher_finalize(GObject *object)
 {
     Dispatcher *self = DISPATCHER(object);
     g_free(self->priv->messages);
-    close(self->priv->send_fd);
-    close(self->priv->recv_fd);
+    socket_close(self->priv->send_fd);
+    socket_close(self->priv->recv_fd);
     pthread_mutex_destroy(&self->priv->lock);
     g_free(self->priv->payload);
     G_OBJECT_CLASS(dispatcher_parent_class)->finalize(object);
@@ -213,7 +213,7 @@ static int read_safe(int fd, uint8_t *buf, size_t size, int block)
         }
     }
     while (read_size < size) {
-        ret = read(fd, buf + read_size, size - read_size);
+        ret = socket_read(fd, buf + read_size, size - read_size);
         if (ret == -1) {
             if (errno == EINTR) {
                 spice_debug("EINTR in read");
@@ -240,7 +240,7 @@ static int write_safe(int fd, uint8_t *buf, size_t size)
     int ret;
 
     while (written_size < size) {
-        ret = write(fd, buf + written_size, size - written_size);
+        ret = socket_write(fd, buf + written_size, size - written_size);
         if (ret == -1) {
             if (errno != EINTR) {
                 return -1;
-- 
2.20.1



More information about the Spice-devel mailing list