From 974736831535ecd0fe165beb55f66b4385b11fb0 Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Wed, 14 Apr 2021 10:12:04 -0400 Subject: [PATCH] Fix: lttng: -Wshadow error in cmd_snapshot MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The optarg variable name shadows a variable in an external dependency. clang returns the following error on my machine: commands/snapshot.c:627:16: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] const char *optarg = poptGetOptArg(pc); ^ /usr/include/x86_64-linux-gnu/bits/getopt_core.h:36:14: note: previous declaration is here extern char *optarg; Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau Change-Id: I85dd7b0761ebc2c023d84ba869c0551f91f38a17 --- src/bin/lttng/commands/snapshot.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bin/lttng/commands/snapshot.c b/src/bin/lttng/commands/snapshot.c index 8f44b9f1c..513257a3c 100644 --- a/src/bin/lttng/commands/snapshot.c +++ b/src/bin/lttng/commands/snapshot.c @@ -624,10 +624,11 @@ int cmd_snapshot(int argc, const char **argv) case OPT_MAX_SIZE: { uint64_t val; - const char *optarg = poptGetOptArg(pc); + const char *max_size_arg = poptGetOptArg(pc); - if (utils_parse_size_suffix((char *) optarg, &val) < 0) { - ERR("Unable to handle max-size value %s", optarg); + if (utils_parse_size_suffix((char *) max_size_arg, &val) < 0) { + ERR("Unable to handle max-size value %s", + max_size_arg); cmd_ret = CMD_ERROR; goto end; } -- 2.34.1