Fix: undefined operation on last_relay_viewer_session_id
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 2 Dec 2014 22:21:11 +0000 (17:21 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 12 Jan 2015 16:54:55 +0000 (11:54 -0500)
Triggers compiler warning on 32-bit build.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/live.c

index 6c3e94f273f55afeb60da5597a4293c452bdc015..bbe419551274bc8a494f56f2fc7ae7dfab8ab5f3 100644 (file)
@@ -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();
This page took 0.026867 seconds and 4 git commands to generate.