Blame SOURCES/0001-channel-main-Avoid-macro-side-effects.patch

be82ae
From d8922b93f52d08fb81cc66842b4df80d1d1d9a7e Mon Sep 17 00:00:00 2001
be82ae
From: Frediano Ziglio <fziglio@redhat.com>
be82ae
Date: Thu, 19 Mar 2020 15:50:45 +0000
be82ae
Subject: [PATCH 1/9] channel-main: Avoid macro side effects
be82ae
be82ae
In big endian system GUINT32_TO_LE macro uses the parameter
be82ae
multiple time causing serial to be incremented multiple times
be82ae
instead of one.
be82ae
Avoid side effects using a temporary variable.
be82ae
be82ae
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
be82ae
Acked-by: Victor Toso <victortoso@redhat.com>
be82ae
(cherry picked from commit 7363d1a0a640b6992d5967621e37c3376958d708)
be82ae
---
be82ae
 src/channel-main.c | 3 ++-
be82ae
 1 file changed, 2 insertions(+), 1 deletion(-)
be82ae
be82ae
diff --git a/src/channel-main.c b/src/channel-main.c
be82ae
index 1e85a36..e89b813 100644
be82ae
--- a/src/channel-main.c
be82ae
+++ b/src/channel-main.c
be82ae
@@ -1384,7 +1384,8 @@ static void agent_clipboard_grab(SpiceMainChannel *channel, guint selection,
be82ae
     }
be82ae
 
be82ae
     if (test_agent_cap(channel, VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL)) {
be82ae
-        *(uint32_t *)grab = GUINT32_TO_LE(c->clipboard_serial[selection]++);
be82ae
+        uint32_t serial = c->clipboard_serial[selection]++;
be82ae
+        *(uint32_t *)grab = GUINT32_TO_LE(serial);
be82ae
         grab = (void *)grab + sizeof(uint32_t);
be82ae
     }
be82ae
 
be82ae
-- 
be82ae
2.26.2
be82ae