diff options
| -rw-r--r-- | tools/perf/perf.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/perf/perf.c b/tools/perf/perf.c index e0279babe0c0..2f19e03c5c40 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c | |||
| @@ -467,15 +467,21 @@ int main(int argc, const char **argv) | |||
| 467 | * - cannot execute it externally (since it would just do | 467 | * - cannot execute it externally (since it would just do |
| 468 | * the same thing over again) | 468 | * the same thing over again) |
| 469 | * | 469 | * |
| 470 | * So we just directly call the internal command handler, and | 470 | * So we just directly call the internal command handler. If that one |
| 471 | * die if that one cannot handle it. | 471 | * fails to handle this, then maybe we just run a renamed perf binary |
| 472 | * that contains a dash in its name. To handle this scenario, we just | ||
| 473 | * fall through and ignore the "xxxx" part of the command string. | ||
| 472 | */ | 474 | */ |
| 473 | if (strstarts(cmd, "perf-")) { | 475 | if (strstarts(cmd, "perf-")) { |
| 474 | cmd += 5; | 476 | cmd += 5; |
| 475 | argv[0] = cmd; | 477 | argv[0] = cmd; |
| 476 | handle_internal_command(argc, argv); | 478 | handle_internal_command(argc, argv); |
| 477 | fprintf(stderr, "cannot handle %s internally", cmd); | 479 | /* |
| 478 | goto out; | 480 | * If the command is handled, the above function does not |
| 481 | * return undo changes and fall through in such a case. | ||
| 482 | */ | ||
| 483 | cmd -= 5; | ||
| 484 | argv[0] = cmd; | ||
| 479 | } | 485 | } |
| 480 | if (strstarts(cmd, "trace")) { | 486 | if (strstarts(cmd, "trace")) { |
| 481 | #ifdef HAVE_LIBAUDIT_SUPPORT | 487 | #ifdef HAVE_LIBAUDIT_SUPPORT |
