Fix: undefined operation on last_relay_viewer_session_id
[lttng-tools.git] / src / bin / lttng-relayd / live.c
index 3728005df77c3efa3d7c9e20f5ca537db26940bf..ed52012407be36ef76a04d1c494a028d148bf6cd 100644 (file)
@@ -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();
@@ -2142,13 +2147,11 @@ int relayd_live_create(struct lttng_uri *uri,
         */
        return retval;
 
+       /*
+        * Join on the live_listener_thread should anything be added after
+        * the live_listener thread's creation.
+        */
 
-       ret = pthread_join(live_listener_thread, &status);
-       if (ret) {
-               errno = ret;
-               PERROR("pthread_join live listener");
-               retval = -1;
-       }
 exit_listener_thread:
 
        ret = pthread_join(live_worker_thread, &status);
This page took 0.024845 seconds and 4 git commands to generate.