This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[BUGFIX PATCH -tip 2/5] perf probe: Fix strtailcmp() to compare s1[0] and s2[0]
- From: Masami Hiramatsu <mhiramat at redhat dot com>
- To: Ingo Molnar <mingo at elte dot hu>, Frederic Weisbecker <fweisbec at gmail dot com>, lkml<linux-kernel at vger dot kernel dot org>
- Cc: systemtap<systemtap at sources dot redhat dot com>, DLE<dle-develop at lists dot sourceforge dot net>, "Juha Leppanen" <juha_motorsportcom at luukku dot com>, Masami Hiramatsu <mhiramat at redhat dot com>
- Date: Mon, 07 Dec 2009 12:00:40 -0500
- Subject: [BUGFIX PATCH -tip 2/5] perf probe: Fix strtailcmp() to compare s1[0] and s2[0]
- References: <20091207170027.19230.39491.stgit@dhcp-100-2-132.bos.redhat.com>
From: Juha Leppanen <juha_motorsportcom@luukku.com>
Fix strtailcmp() to compare s1[0] and s2[0].
strtailcmp() returns 0 if "a" and "b" or "a" and "ab", it's
a wrong behavior. This patch fixes it.
Signed-off-by: "Juha Leppanen" <juha_motorsportcom@luukku.com>
Reported-by: "Juha Leppanen" <juha_motorsportcom@luukku.com>
Acked-by: Masami Hiramatsu <mhiramat@redhat.com>
---
tools/perf/util/probe-finder.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 293cdfc..4585f1d 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -106,7 +106,7 @@ static int strtailcmp(const char *s1, const char *s2)
{
int i1 = strlen(s1);
int i2 = strlen(s2);
- while (--i1 > 0 && --i2 > 0) {
+ while (--i1 >= 0 && --i2 >= 0) {
if (s1[i1] != s2[i2])
return s1[i1] - s2[i2];
}
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division
e-mail: mhiramat@redhat.com