From: David Goulet Date: Thu, 20 Dec 2012 19:13:07 +0000 (-0500) Subject: Fix: lttng create URI parsing and check X-Git-Tag: v2.1.0~1 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=0ab619061fcf5f38193da3b2839c7d0963b61ac9 Fix: lttng create URI parsing and check Signed-off-by: David Goulet --- 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) {