Fix: Racy event validation in tests
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.c
index 532af7d9917b733b33b59d6309f9a184417c6fbb..36fe233ae8fc8681c0a90ef8b854d76af01c888e 100644 (file)
@@ -458,6 +458,7 @@ static int add_uri_to_consumer(struct consumer_output *consumer,
                         * URI was the same in the consumer so we do not append the subdir
                         * again so to not duplicate output dir.
                         */
+                       ret = LTTNG_OK;
                        goto error;
                }
 
@@ -2506,6 +2507,7 @@ void cmd_list_lttng_sessions(struct lttng_session *sessions, uid_t uid,
                sessions[i].name[NAME_MAX - 1] = '\0';
                sessions[i].enabled = session->enabled;
                sessions[i].snapshot_mode = session->snapshot_mode;
+               sessions[i].live_timer_interval = session->live_timer;
                i++;
        }
 }
@@ -2526,6 +2528,21 @@ int cmd_data_pending(struct ltt_session *session)
        if (session->enabled) {
                ret = LTTNG_ERR_SESSION_STARTED;
                goto error;
+       } else {
+               /*
+                * If stopped, just make sure we've started before else the above call
+                * will always send that there is data pending.
+                *
+                * The consumer assumes that when the data pending command is received,
+                * the trace has been started before or else no output data is written
+                * by the streams which is a condition for data pending. So, this is
+                * *VERY* important that we don't ask the consumer before a start
+                * trace.
+                */
+               if (!session->started) {
+                       ret = 0;
+                       goto error;
+               }
        }
 
        if (ksess && ksess->consumer) {
This page took 0.025437 seconds and 4 git commands to generate.