From: Aaron Merey Date: Tue, 15 Jul 2025 04:25:51 +0000 (-0400) Subject: elf_getaroff: Fix elf_getaroff error return value X-Git-Tag: elfutils-0.194~50 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4f7334def885fc6f7e7b9cb86bd8ab774a835129;p=thirdparty%2Felfutils.git elf_getaroff: Fix elf_getaroff error return value elf_getaroff currently returns ELF_C_NULL (0) to indicate that an error occured (ex. the Elf descriptor is not associated with an archive). However elf_getaroff is intended to return -1 if an error occurs. eu-ar assumes -1 indicates an error and other libelf implementations use -1 to indicate an error in elf_getaroff. Replace ELF_C_NULL with -1 as elf_getaroff's error return value. Signed-off-by: Aaron Merey --- diff --git a/libelf/elf_getaroff.c b/libelf/elf_getaroff.c index 5c102ad6..5737b350 100644 --- a/libelf/elf_getaroff.c +++ b/libelf/elf_getaroff.c @@ -43,7 +43,7 @@ elf_getaroff (Elf *elf) { /* Be gratious, the specs demand it. */ if (elf == NULL || elf->parent == NULL) - return ELF_C_NULL; + return -1; /* We can be sure the parent is an archive. */ Elf *parent = elf->parent;