[Spice-devel] [PATCH] remove a warning building a test

Frediano Ziglio fziglio at redhat.com
Mon May 16 16:13:11 UTC 2016


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/tests/stream-test.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/server/tests/stream-test.c b/server/tests/stream-test.c
index 6317796..8fd1449 100644
--- a/server/tests/stream-test.c
+++ b/server/tests/stream-test.c
@@ -35,6 +35,7 @@ sock_fd_read(int sock, void *buf, ssize_t bufsize, int *fd)
             char control[CMSG_SPACE(sizeof (int))];
         } cmsgu;
         struct cmsghdr *cmsg;
+        int i;
 
         iov.iov_base = buf;
         iov.iov_len = bufsize;
@@ -63,7 +64,8 @@ sock_fd_read(int sock, void *buf, ssize_t bufsize, int *fd)
                 exit(1);
             }
 
-            *fd = *((int *) CMSG_DATA(cmsg));
+            memcpy(&i, CMSG_DATA(cmsg), sizeof(i));
+            *fd = i;
         } else
             *fd = -1;
     } else {
-- 
2.7.4



More information about the Spice-devel mailing list