Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf symbols: Check return value of filename__read_debuglink()

When dso__read_binary_type_filename() called, it doesn't check the
return value of filename__read_debuglink() so that it'll try to open the
debuglink file even if it doesn't exist.

Also fix return value of the filename__read_debuglink() as it always
return -1 regardless of the result.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Cody P Schafer <cody@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1392859976-32760-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Stephane Eranian and committed by
Arnaldo Carvalho de Melo
0d3dc5e8 9e8c06ea

+4 -2
+2 -2
tools/perf/util/dso.c
··· 45 45 debuglink--; 46 46 if (*debuglink == '/') 47 47 debuglink++; 48 - filename__read_debuglink(dso->long_name, debuglink, 49 - size - (debuglink - filename)); 48 + ret = filename__read_debuglink(dso->long_name, debuglink, 49 + size - (debuglink - filename)); 50 50 } 51 51 break; 52 52 case DSO_BINARY_TYPE__BUILD_ID_CACHE:
+2
tools/perf/util/symbol-elf.c
··· 506 506 /* the start of this section is a zero-terminated string */ 507 507 strncpy(debuglink, data->d_buf, size); 508 508 509 + err = 0; 510 + 509 511 out_elf_end: 510 512 elf_end(elf); 511 513 out_close: