aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasami Hiramatsu <[email protected]>2010-04-14 18:39:35 -0400
committerArnaldo Carvalho de Melo <[email protected]>2010-04-14 17:41:14 -0300
commitdd259c5db26ccda46409dbf6efc79d5a2b259e38 (patch)
treec392f55f5a6529c053c1a5581d96b007f2a92229
parent7ca5989dd065cbc48a958666c273794686ea7525 (diff)
perf probe: Fix mis-estimation for shortening filename
Fix mis-estimation size for making a short filename. Since the buffer size is 32 bytes and there are '@' prefix and '\0' termination, maximum shorten filename length should be 30. This means, before searching '/', it should be 31 bytes. LKML-Reference: <[email protected]> Signed-off-by: Masami Hiramatsu <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/util/probe-event.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 1c4a20a284c0..6d438391bae5 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -806,12 +806,12 @@ static char *synthesize_perf_probe_point(struct perf_probe_point *pp)
goto error;
}
if (pp->file) {
- len = strlen(pp->file) - 32;
+ len = strlen(pp->file) - 31;
if (len < 0)
len = 0;
tmp = strchr(pp->file + len, '/');
if (!tmp)
- tmp = pp->file + len - 1;
+ tmp = pp->file + len;
ret = e_snprintf(file, 32, "@%s", tmp + 1);
if (ret <= 0)
goto error;