diff options
Diffstat (limited to '')
-rw-r--r-- | tools/perf/builtin-help.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c index 3976aebe3677..7be6fb6df595 100644 --- a/tools/perf/builtin-help.c +++ b/tools/perf/builtin-help.c @@ -14,10 +14,12 @@ #include <subcmd/run-command.h> #include <subcmd/help.h> #include "util/debug.h" +#include "util/util.h" #include <linux/kernel.h> #include <linux/string.h> #include <linux/zalloc.h> #include <errno.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -388,9 +390,10 @@ static int get_html_page_path(char **page_path, const char *page) { struct stat st; const char *html_path = system_path(PERF_HTML_PATH); + char path[PATH_MAX]; /* Check that we have a perf documentation directory. */ - if (stat(mkpath("%s/perf.html", html_path), &st) + if (stat(mkpath(path, sizeof(path), "%s/perf.html", html_path), &st) || !S_ISREG(st.st_mode)) { pr_err("'%s': not a documentation directory.", html_path); return -1; @@ -414,7 +417,7 @@ static void open_html(const char *path) static int show_html_page(const char *perf_cmd) { const char *page = cmd_to_page(perf_cmd); - char *page_path; /* it leaks but we exec bellow */ + char *page_path; /* it leaks but we exec below */ if (get_html_page_path(&page_path, page) < 0) return -1; @@ -444,9 +447,7 @@ int cmd_help(int argc, const char **argv) #ifdef HAVE_LIBELF_SUPPORT "probe", #endif -#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT) "trace", -#endif NULL }; const char *builtin_help_usage[] = { "perf help [--all] [--man|--web|--info] [command]", |