From 4b35a6b3dbbaf925b2cb95ab36bef3546334607a Mon Sep 17 00:00:00 2001 From: David Goulet Date: Mon, 22 Oct 2012 15:32:34 -0400 Subject: [PATCH] Fix: segfault on create session with two URLs https://bugs.lttng.org/issues/350 Fixes #350 Signed-off-by: David Goulet --- src/bin/lttng-sessiond/cmd.c | 12 ++---------- src/lib/lttng-ctl/lttng-ctl.c | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 1d4f9264e..f72d4bb17 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1528,11 +1528,6 @@ int cmd_set_consumer_uri(int domain, struct ltt_session *session, goto error; } - if (!session->start_consumer) { - ret = LTTNG_ERR_NO_CONSUMER; - goto error; - } - /* * This case switch makes sure the domain session has a temporary consumer * so the URL can be set. @@ -2142,11 +2137,6 @@ int cmd_enable_consumer(int domain, struct ltt_session *session) goto error; } - if (!session->start_consumer) { - ret = LTTNG_ERR_NO_CONSUMER; - goto error; - } - switch (domain) { case 0: assert(session->consumer); @@ -2320,6 +2310,8 @@ int cmd_enable_consumer(int domain, struct ltt_session *session) break; } + session->start_consumer = 1; + /* Enable it */ if (consumer) { consumer->enabled = 1; diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index 67c597219..cc69dd5c2 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -1625,7 +1625,7 @@ int _lttng_create_session_ext(const char *name, const char *url, lsm.u.uri.size = size; - if (uris[0].dtype != LTTNG_DST_PATH && strlen(uris[0].subdir) == 0) { + if (size > 0 && uris[0].dtype != LTTNG_DST_PATH && strlen(uris[0].subdir) == 0) { ret = snprintf(uris[0].subdir, sizeof(uris[0].subdir), "%s-%s", name, datetime); if (ret < 0) { -- 2.34.1