summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaeung Song <treeze.taeung@gmail.com>2017-06-17 06:46:37 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-06-20 04:05:54 +0300
commit4f1fd74283582f3f5c34d1c9ed55117d775b4a20 (patch)
treecdb3dfeb686a9608759d51b1937a16845a3a69de
parent1096c35aa821cc4789a64232a0e210bb87a0e5e8 (diff)
downloadlinux-4f1fd74283582f3f5c34d1c9ed55117d775b4a20.tar.xz
perf config: Check error cases of {show_spec, set}_config()
show_spec_config() and set_config() can be called multiple times in the loop in cmd_config(). However, The error cases of them wasn't checked, so fix it. Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Taeung Song <treeze.taeung@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/1497671197-20450-1-git-send-email-treeze.taeung@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/builtin-config.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c
index 75459668edb2..bb1be79bceda 100644
--- a/tools/perf/builtin-config.c
+++ b/tools/perf/builtin-config.c
@@ -225,10 +225,23 @@ int cmd_config(int argc, const char **argv)
break;
}
- if (value == NULL)
+ if (value == NULL) {
ret = show_spec_config(set, var);
- else
+ if (ret < 0) {
+ pr_err("%s is not configured: %s\n",
+ var, config_filename);
+ free(arg);
+ break;
+ }
+ } else {
ret = set_config(set, config_filename, var, value);
+ if (ret < 0) {
+ pr_err("Failed to set '%s=%s' on %s\n",
+ var, value, config_filename);
+ free(arg);
+ break;
+ }
+ }
free(arg);
}
}