perf probe: Fix not to return non-matched file
authorMasami Hiramatsu <mhiramat@redhat.com>
Fri, 2 Apr 2010 16:50:45 +0000 (12:50 -0400)
committerIngo Molnar <mingo@elte.hu>
Fri, 2 Apr 2010 17:35:42 +0000 (19:35 +0200)
Fix cu_find_realpath() not to return the last file path
if that is not matched to input pattern.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
LKML-Reference: <20100402165045.23551.47780.stgit@localhost6.localdomain6>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
tools/perf/util/probe-finder.c

index db52ec2..b44132e 100644 (file)
@@ -183,6 +183,8 @@ static const char *cu_find_realpath(Dwarf_Die *cu_die, const char *fname)
                if (strtailcmp(src, fname) == 0)
                        break;
        }
+       if (i == nfiles)
+               return NULL;
        return src;
 }