[PATCH] perf help: Fix a bug during strstart() conversion

From: Namhyung Kim
Date: Mon Nov 13 2017 - 19:10:43 EST


The commit 8e99b6d4533c changed prefixcmp() to strstart() but missed to
change the return value in some place. It makes perf help print
annoying output even for sane config items like below:

$ perf help
'.root': unsupported man viewer sub key.
...

Fixes: 8e99b6d4533c ("tools include: Adopt strstarts() from the kernel")
Cc: Taeung Song <treeze.taeung@xxxxxxxxx>
Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/builtin-help.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index dbe4e4153bcf..ff51e5fc0daf 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -283,7 +283,7 @@ static int perf_help_config(const char *var, const char *value, void *cb)
add_man_viewer(value);
return 0;
}
- if (!strstarts(var, "man."))
+ if (strstarts(var, "man."))
return add_man_viewer_info(var, value);

return 0;
@@ -313,7 +313,7 @@ static const char *cmd_to_page(const char *perf_cmd)

if (!perf_cmd)
return "perf";
- else if (!strstarts(perf_cmd, "perf"))
+ else if (strstarts(perf_cmd, "perf"))
return perf_cmd;

return asprintf(&s, "perf-%s", perf_cmd) < 0 ? NULL : s;
--
2.15.0