Skip to content

Commit afc45cf

Browse files
committed
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 <[email protected]> Cc: David Ahern <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Taeung Song <[email protected]> Cc: Wang Nan <[email protected]> Fixes: 8beeb00 ("perf config: Use new perf_config_set__init() to initialize config set") Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent e572d08 commit afc45cf

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tools/perf/util/config.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -646,20 +646,22 @@ static int perf_config_set__init(struct perf_config_set *set)
646646
goto out;
647647
}
648648

649-
if (stat(user_config, &st) < 0)
649+
if (stat(user_config, &st) < 0) {
650+
if (errno == ENOENT)
651+
ret = 0;
650652
goto out_free;
653+
}
654+
655+
ret = 0;
651656

652657
if (st.st_uid && (st.st_uid != geteuid())) {
653658
warning("File %s not owned by current user or root, "
654659
"ignoring it.", user_config);
655660
goto out_free;
656661
}
657662

658-
if (!st.st_size)
659-
goto out_free;
660-
661-
ret = perf_config_from_file(collect_config, user_config, set);
662-
663+
if (st.st_size)
664+
ret = perf_config_from_file(collect_config, user_config, set);
663665
out_free:
664666
free(user_config);
665667
}

0 commit comments

Comments
 (0)