aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2017-01-27 08:21:01 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-01-27 08:28:34 -0500
commitafc45cf52c93009f1f4432e50365ce294ba7a474 (patch)
tree40f82fe1d17a2ef733b31688b806dad2c1886a20 /tools/perf
parente572d0887137acfc53f18175522964ec19d88175 (diff)
perf config: Do not consider an error not to have any perfconfig file
While propagating the errors from perf_config(), which were being completely ignored, everything stopped working for people without a ~/.perfconfig file, because the perf_config_set__init() was considering an error not to have a .perfconfig file, duh, fix it by checking the errno after the failed stat() call. It should also not return an error when it says it is ignoring the file, and also a empty file should not return an error either. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Taeung Song <treeze.taeung@gmail.com> Cc: Wang Nan <wangnan0@huawei.com> Fixes: 8beeb00f2c84 ("perf config: Use new perf_config_set__init() to initialize config set") Link: http://lkml.kernel.org/n/tip-ygpbab3apbs6l8wr97xedwks@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/config.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 3d906dbbef74..615e8b4a693b 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -646,8 +646,13 @@ static int perf_config_set__init(struct perf_config_set *set)
646 goto out; 646 goto out;
647 } 647 }
648 648
649 if (stat(user_config, &st) < 0) 649 if (stat(user_config, &st) < 0) {
650 if (errno == ENOENT)
651 ret = 0;
650 goto out_free; 652 goto out_free;
653 }
654
655 ret = 0;
651 656
652 if (st.st_uid && (st.st_uid != geteuid())) { 657 if (st.st_uid && (st.st_uid != geteuid())) {
653 warning("File %s not owned by current user or root, " 658 warning("File %s not owned by current user or root, "
@@ -655,11 +660,8 @@ static int perf_config_set__init(struct perf_config_set *set)
655 goto out_free; 660 goto out_free;
656 } 661 }
657 662
658 if (!st.st_size) 663 if (st.st_size)
659 goto out_free; 664 ret = perf_config_from_file(collect_config, user_config, set);
660
661 ret = perf_config_from_file(collect_config, user_config, set);
662
663out_free: 665out_free:
664 free(user_config); 666 free(user_config);
665 } 667 }