Fix: Clamp verbosity value read from config file
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 10 Jul 2014 21:41:08 +0000 (17:41 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 11 Jul 2014 20:02:11 +0000 (16:02 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/main.c

index 548cc43095b633bb09528085dfb878a5e99578f6..6a918ec56a73926621a20119eb3e3686d0f3d998 100644 (file)
@@ -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) {
This page took 0.029199 seconds and 4 git commands to generate.