Differentiate when same error message using func and line C macros
authorSofian Brabez <sbz@FreeBSD.org>
Tue, 16 Feb 2021 14:59:33 +0000 (14:59 +0000)
committerSofian Brabez <sbz@FreeBSD.org>
Tue, 16 Feb 2021 14:59:33 +0000 (14:59 +0000)
elf.c

diff --git a/elf.c b/elf.c
index e7da3c119be5603f823f0805dec06b4236b89686..5b6489967769ccdc68edb52977b6ca3157ac362e 100644 (file)
--- a/elf.c
+++ b/elf.c
@@ -37,10 +37,10 @@ elf_init(const char *filename)
        e->ehdr_size = e->ehdr->e_ehsize;
 
        if (e->sb.st_size < sizeof(Elf_Ehdr))
-               errx(1, "not a ELF object");
+               errx(1, "not a ELF object %s:%d", __func__, __LINE__);
 
        if (memcmp(e->ehdr->e_ident, ELFMAG, sizeof(ELFMAG) - 1) != 0)
-               errx(1, "not a ELF object");
+               errx(1, "not a ELF object %s:%d", __func__, __LINE__);
 
        e->shdr = (Elf_Shdr *)(e->mm + e->ehdr->e_shoff);
        e->shdr_size = e->ehdr->e_shnum;