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 <ame...@redhat.com>
---
 libelf/elf_getaroff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
-- 
2.50.0

Reply via email to