X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=1dec61ea17b6ba7f74e122e37a7df99afa2e07c6;hp=a164cffc0fcd8b049f6ea63dcb19fa4a02707933;hb=e3876bf0e1d1be72170b53e9fcb39f3108f069dc;hpb=6718a79b6e5cc242bc70ca581c62008a29a9d5a8 diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index a164cffc0..1dec61ea1 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -2759,11 +2759,32 @@ int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri, goto error; } + for (i = 0; i < nb_uri; i++) { + if (uris[i].stype != LTTNG_STREAM_CONTROL || + uris[i].subdir[0] == '\0') { + /* Not interested in these URIs */ + continue; + } + + if (session->base_path != NULL) { + free(session->base_path); + session->base_path = NULL; + } + + /* Set session base_path */ + session->base_path = strdup(uris[i].subdir); + if (!session->base_path) { + PERROR("Copying base path: %s", uris[i].subdir); + goto error; + } + DBG2("Setting base path for session %" PRIu64 ": %s", + session->id, session->base_path); + } + /* Set the "global" consumer URIs */ for (i = 0; i < nb_uri; i++) { - ret = add_uri_to_consumer(session, - session->consumer, - &uris[i], LTTNG_DOMAIN_NONE); + ret = add_uri_to_consumer(session, session->consumer, &uris[i], + LTTNG_DOMAIN_NONE); if (ret != LTTNG_OK) { goto error; } @@ -2894,7 +2915,6 @@ enum lttng_error_code cmd_create_session_from_descriptor( const char *session_name; struct ltt_session *new_session = NULL; enum lttng_session_descriptor_status descriptor_status; - const char *base_path; session_lock_list(); if (home_path) { @@ -2917,13 +2937,9 @@ enum lttng_error_code cmd_create_session_from_descriptor( ret_code = LTTNG_ERR_INVALID; goto end; } - ret = lttng_session_descriptor_get_base_path(descriptor, &base_path); - if (ret) { - ret_code = LTTNG_ERR_INVALID; - goto end; - } + ret_code = session_create(session_name, creds->uid, creds->gid, - base_path, &new_session); + &new_session); if (ret_code != LTTNG_OK) { goto end; }