libbtf: Make can't get header message to appear only in verbose mode

This usually means we're trying each of the type loaders (DWARF, BTF,
CTF) on some invalid file, so no need to show that message, use verbose
mode to get it, so that we show that all loaders are being tried.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2020-10-01 10:06:18 -03:00
parent fc2b317db0
commit 63e11400e8
1 changed files with 2 additions and 1 deletions

View File

@ -191,7 +191,8 @@ struct btf_elf *btf_elf__new(const char *filename, Elf *elf)
}
if (gelf_getehdr(btfe->elf, &btfe->ehdr) == NULL) {
fprintf(stderr, "%s: cannot get elf header.\n", __func__);
if (btf_elf__verbose)
fprintf(stderr, "%s: cannot get elf header.\n", __func__);
goto errout;
}