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.5.0~15 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=95df5340727bbba0a4f84d2566f5a4474b91a3f2;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) {