From: David Goulet Date: Tue, 17 Jan 2012 22:03:57 +0000 (-0500) Subject: Don't start session daemon with --help on the cli X-Git-Tag: v2.0-pre17~5 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=bcfa8a05018b339b9b5609fe975a3a7b29cc0c6e;p=lttng-tools.git Don't start session daemon with --help on the cli Any --help or -h will not spawned anymore a session daemon when used with lttng cli. Signed-off-by: David Goulet --- diff --git a/lttng/lttng.c b/lttng/lttng.c index d0f23579d..45a6fa0be 100644 --- a/lttng/lttng.c +++ b/lttng/lttng.c @@ -359,6 +359,23 @@ end: return ret; } +/* + * Check for the "help" option in the argv. If found, return 1 else return 0. + */ +static int check_help_command(int argc, char **argv) +{ + int i; + + for (i = 0; i < argc; i++) { + if ((strncmp(argv[i], "-h", 2) == 0) || + strncmp(argv[i], "--h", 3)) { + return 1; + } + } + + return 0; +} + /* * parse_args * @@ -414,7 +431,8 @@ static int parse_args(int argc, char **argv) } /* Spawn session daemon if needed */ - if (opt_no_sessiond == 0 && (check_sessiond() < 0)) { + if (opt_no_sessiond == 0 && check_help_command(argc, argv) == 0 && + (check_sessiond() < 0)) { goto error; }