From: Jérémie Galarneau Date: Thu, 10 Jul 2014 21:41:08 +0000 (-0400) Subject: Fix: Clamp verbosity value read from config file X-Git-Tag: v2.6.0-rc1~149 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=13755a18f06a510c0e304216cc207ffdbd0ae1c4;p=lttng-tools.git Fix: Clamp verbosity value read from config file Signed-off-by: Jérémie Galarneau Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 548cc4309..6a918ec56 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -4240,13 +4240,15 @@ static int set_option(int opt, const char *arg, const char *optname) case 'v': /* Verbose level can increase using multiple -v */ if (arg) { + /* Value obtained from config file */ lttng_opt_verbose = config_parse_value(arg); } else { - /* Only 3 level of verbosity (-vvv). */ - if (lttng_opt_verbose < 3) { - lttng_opt_verbose += 1; - } + /* -v used on command line */ + lttng_opt_verbose++; } + /* Clamp value to [0, 3] */ + lttng_opt_verbose = lttng_opt_verbose < 0 ? 0 : + (lttng_opt_verbose <= 3 ? lttng_opt_verbose : 3); break; case 'Z': if (arg) {