diff options
Diffstat (limited to 'tools/perf/builtin-help.c')
| -rw-r--r-- | tools/perf/builtin-help.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c index 3d29d0524a89..7be6fb6df595 100644 --- a/tools/perf/builtin-help.c +++ b/tools/perf/builtin-help.c @@ -4,8 +4,9 @@ * * Builtin help command */ -#include "perf.h" +#include "util/cache.h" #include "util/config.h" +#include "util/strbuf.h" #include "builtin.h" #include <subcmd/exec-cmd.h> #include "common-cmds.h" @@ -13,9 +14,15 @@ #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> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> @@ -383,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; @@ -409,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; @@ -439,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]", |
