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

Frediano Ziglio fziglio at redhat.com
Fri Mar 29 09:00:06 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 bae73f7db..9a49a9899 100644
--- a/server/dispatcher.c
+++ b/server/dispatcher.c
@@ -115,8 +115,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);
@@ -215,7 +215,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");
@@ -242,7 +242,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