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

35 lines
1.2 KiB
Diff
Raw Normal View History

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