[Spice-devel] [PATCH spice-server] test-channel: Use correct endianness for ack message

Frediano Ziglio fziglio at redhat.com
Fri Jan 5 12:12:00 UTC 2018


Network fields should be encoded as little endian.
This was discovered using an emulated MIPS machine.

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

diff --git a/server/tests/test-channel.c b/server/tests/test-channel.c
index fb3db389..455711eb 100644
--- a/server/tests/test-channel.c
+++ b/server/tests/test-channel.c
@@ -189,9 +189,9 @@ static void send_ack_sync(int socket, uint32_t generation)
         uint32_t generation;
     } msg;
     SPICE_VERIFY(sizeof(msg) == 12);
-    msg.type = SPICE_MSGC_ACK_SYNC;
-    msg.len = sizeof(generation);
-    msg.generation = generation;
+    msg.type = GUINT16_TO_LE(SPICE_MSGC_ACK_SYNC);
+    msg.len = GUINT32_TO_LE(sizeof(generation));
+    msg.generation = GUINT32_TO_LE(generation);
 
     g_assert_cmpint(write(socket, &msg.type, 10), ==, 10);
 }
-- 
2.14.3



More information about the Spice-devel mailing list