From 034c8d01602c68ae4a03bdcf01ef86d64cf356e4 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Thu, 20 Jun 2019 15:50:20 -0400 Subject: [PATCH] Fix: bt_config_convert_from_args(): set default log level at the end too Issue ===== There are code paths which make bt_config_convert_from_args() return a configuration while not having set the default log level. For example, with `-o ctf-metadata`, the function calls bt_config_print_ctf_metadata_create() to create such a configuration, and then goes to the `end` label). Solution ======== Make sure it is set to the CLI's default log level value when reaching the end of the function. Known drawbacks =============== None. Signed-off-by: Philippe Proulx Change-Id: I2ee21a754aeaea65fd6d4fbfcae5bd2f07fcba7c Reviewed-on: https://review.lttng.org/c/babeltrace/+/1525 Tested-by: jenkins --- src/cli/babeltrace2-cfg-cli-args.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/cli/babeltrace2-cfg-cli-args.c b/src/cli/babeltrace2-cfg-cli-args.c index a6e61c10..c4cb1756 100644 --- a/src/cli/babeltrace2-cfg-cli-args.c +++ b/src/cli/babeltrace2-cfg-cli-args.c @@ -4878,6 +4878,14 @@ error: BT_OBJECT_PUT_REF_AND_RESET(cfg); end: + /* + * If the log level is still unset at this point, set it to + * the program's default. + */ + if (*default_log_level < 0) { + *default_log_level = cli_default_log_level; + } + if (pc) { poptFreeContext(pc); } -- 2.34.1