[Spice-devel] [PATCH spice-server v4 12/20] dispatcher: Use socket compatibility layer

Frediano Ziglio fziglio at redhat.com
Wed Feb 6 13:58:48 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 3e27f2c2..657bfc7d 100644
--- a/server/dispatcher.c
+++ b/server/dispatcher.c
@@ -109,8 +109,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);
@@ -211,7 +211,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");
@@ -238,7 +238,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