From 0ab619061fcf5f38193da3b2839c7d0963b61ac9 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Thu, 20 Dec 2012 14:13:07 -0500 Subject: [PATCH] Fix: lttng create URI parsing and check Signed-off-by: David Goulet --- src/bin/lttng/commands/create.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/bin/lttng/commands/create.c b/src/bin/lttng/commands/create.c index 08b12a46e..d66f0309e 100644 --- a/src/bin/lttng/commands/create.c +++ b/src/bin/lttng/commands/create.c @@ -112,7 +112,7 @@ static void usage(FILE *ofp) fprintf(ofp, " TCP for both control (PORT1) and data port (PORT2).\n"); fprintf(ofp, " The default ports are respectively 5342 and 5343.\n"); fprintf(ofp, "\n"); - fprintf(ofp, " > tcp[4|6]://...\n"); + fprintf(ofp, " > tcp[6]://...\n"); fprintf(ofp, " Can only be used with -C and -D together\n"); fprintf(ofp, "\n"); fprintf(ofp, "NOTE: IPv6 address MUST be enclosed in brackets '[]' (rfc2732)\n"); @@ -350,9 +350,11 @@ static int create_session(void) } MSG("Session %s created.", session_name); - MSG("Traces will be written in %s", print_str_url); + if (print_str_url) { + MSG("Traces will be written in %s", print_str_url); + } - if (opt_ctrl_url || opt_data_url) { + if (opt_ctrl_url && opt_data_url) { /* Setting up control URI (-C or/and -D opt) */ ret = set_consumer_url(session_name, opt_ctrl_url, opt_data_url); if (ret < 0) { @@ -363,6 +365,11 @@ static int create_session(void) if (ret < 0) { goto error; } + } else if ((!opt_ctrl_url && opt_data_url) || + (opt_ctrl_url && !opt_data_url)) { + ERR("You need both control and data URL."); + ret = CMD_ERROR; + goto error; } if (opt_disable_consumer && !opt_no_consumer) { -- 2.34.1