+ return 0;
+
+end:
+ ERR("%s", lttng_get_readable_code(ret));
+error: /* fall through */
+ return ret;
+}
+
+/*
+ * set_opt_session_info
+ *
+ * Setup session_name, current_uuid, short_str_uuid and
+ * long_str_uuid using the command line options.
+ */
+static void set_opt_session_info(void)
+{
+ int count, i, short_len;
+ char *tok;
+ struct lttng_session *sessions;
+
+ if (opt_session_uuid != NULL) {
+ short_len = sizeof(short_str_uuid) - 1;
+ /* Shorten uuid */
+ tok = strchr(opt_session_uuid, '.');
+ if (strlen(tok + 1) == short_len) {
+ memcpy(short_str_uuid, tok + 1, short_len);
+ short_str_uuid[short_len] = '\0';
+ }
+
+ /* Get long real uuid_t from session daemon */
+ count = lttng_list_sessions(&sessions);
+ for (i = 0; i < count; i++) {
+ uuid_unparse(sessions[i].uuid, long_str_uuid);
+ if (strncmp(long_str_uuid, short_str_uuid, 8) == 0) {
+ uuid_copy(current_uuid, sessions[i].uuid);
+ break;
+ }