X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Flive.c;h=ed52012407be36ef76a04d1c494a028d148bf6cd;hp=55f5c80355afb7535e36056352218bc66967ecaa;hb=93b4787b203ca4286c29ed484684ed34c3c8fe5d;hpb=f48c25b760239f20a6e82f3839e04f82d07bdeea diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c index 55f5c8035..ed5201240 100644 --- a/src/bin/lttng-relayd/live.c +++ b/src/bin/lttng-relayd/live.c @@ -712,7 +712,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();