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>
This commit is contained in:
Stephane Eranian 2014-02-20 10:32:55 +09:00 коммит произвёл Arnaldo Carvalho de Melo
Родитель 9e8c06eaba
Коммит 0d3dc5e8b8
2 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -45,7 +45,7 @@ int dso__read_binary_type_filename(const struct dso *dso,
debuglink--; debuglink--;
if (*debuglink == '/') if (*debuglink == '/')
debuglink++; debuglink++;
filename__read_debuglink(dso->long_name, debuglink, ret = filename__read_debuglink(dso->long_name, debuglink,
size - (debuglink - filename)); size - (debuglink - filename));
} }
break; break;

Просмотреть файл

@ -506,6 +506,8 @@ int filename__read_debuglink(const char *filename, char *debuglink,
/* the start of this section is a zero-terminated string */ /* the start of this section is a zero-terminated string */
strncpy(debuglink, data->d_buf, size); strncpy(debuglink, data->d_buf, size);
err = 0;
out_elf_end: out_elf_end:
elf_end(elf); elf_end(elf);
out_close: out_close: