From ae3b9aa4e260f2ab0bfa352b36589cb8d1ba4a85 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 22 Feb 2017 10:17:45 -0500 Subject: [PATCH] babeltrace-cfg.c: do not allow duplicate -v option MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Otherwise, `babeltrace -vvv list-plugins` passes and tries to open the `list-plugins` directory with ctf.fs. Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- converter/babeltrace-cfg.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/converter/babeltrace-cfg.c b/converter/babeltrace-cfg.c index b64fa8db..9945f135 100644 --- a/converter/babeltrace-cfg.c +++ b/converter/babeltrace-cfg.c @@ -3310,6 +3310,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[], struct bt_value *instance_names = NULL; struct bt_value *connection_args = NULL; char error_buf[256] = { 0 }; + bool got_verbose_opt = false; *retcode = 0; memset(&ctf_legacy_opts, 0, sizeof(ctf_legacy_opts)); @@ -3835,8 +3836,14 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[], BT_PUT(cfg); goto end; case OPT_VERBOSE: + if (got_verbose_opt) { + printf_err("Duplicate -v option\n"); + goto error; + } + text_legacy_opts.verbose = true; cfg->verbose = true; + got_verbose_opt = true; break; case OPT_DEBUG: cfg->debug = true; -- 2.34.1