From 19eba2998c1676926721980b94998a1bb211d275 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 2 Dec 2014 17:21:11 -0500 Subject: [PATCH] Fix: undefined operation on last_relay_viewer_session_id MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Triggers compiler warning on 32-bit build. Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- src/bin/lttng-relayd/live.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c index 6c3e94f27..bbe419551 100644 --- a/src/bin/lttng-relayd/live.c +++ b/src/bin/lttng-relayd/live.c @@ -735,7 +735,12 @@ int viewer_connect(struct relay_connection *conn) reply.major = htobe32(reply.major); reply.minor = htobe32(reply.minor); if (conn->type == RELAY_VIEWER_COMMAND) { - reply.viewer_session_id = htobe64(++last_relay_viewer_session_id); + /* + * Increment outside of htobe64 macro, because can be used more than once + * within the macro, and thus the operation may be undefined. + */ + last_relay_viewer_session_id++; + reply.viewer_session_id = htobe64(last_relay_viewer_session_id); } health_code_update(); -- 2.34.1