+
+error:
+ return ret;
+}
+
+/*
+ * process_opt_session_uuid
+ *
+ * Set current session uuid to the current flow of
+ * command(s) using the already shorten uuid.
+ */
+static int process_opt_session_uuid(void)
+{
+ int ret, count, i;
+ struct lttng_session *sessions;
+
+ count = lttng_list_sessions(&sessions);
+ if (count < 0) {
+ ret = count;
+ goto error;
+ }
+
+ for (i = 0; i < count; i++) {
+ if (strncmp(sessions[i].uuid, short_uuid, 8) == 0) {
+ lttng_set_current_session_uuid(sessions[i].uuid);
+ break;
+ }
+ }
+
+ free(sessions);
+
+ return 0;
+
+error:
+ return ret;