X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=edb5a3433049da305ddc11563f4612285a3bb1c6;hb=3dd2c2c6d9e1af9e002267773915d5029b14d17e;hp=731040a3c6c9e157ec2fe9f9b91268ae4fdbccf6;hpb=414362e7d0c194a19d02654a861584a3efaf9614;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 731040a3c..edb5a3433 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1613,6 +1613,16 @@ int cmd_add_context(struct ltt_session *session, enum lttng_domain_type domain, int ret, chan_kern_created = 0, chan_ust_created = 0; char *app_ctx_provider_name = NULL, *app_ctx_name = NULL; + /* + * Don't try to add a context if the session has been started at + * some point in time before. The tracer does not allow it and would + * result in a corrupted trace. + */ + if (session->has_been_started) { + ret = LTTNG_ERR_TRACE_ALREADY_STARTED; + goto end; + } + if (ctx->ctx == LTTNG_EVENT_CONTEXT_APP_CONTEXT) { app_ctx_provider_name = ctx->u.app_ctx.provider_name; app_ctx_name = ctx->u.app_ctx.ctx_name;