]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
elf_getaroff: Fix elf_getaroff error return value
authorAaron Merey <amerey@redhat.com>
Tue, 15 Jul 2025 04:25:51 +0000 (00:25 -0400)
committerAaron Merey <amerey@redhat.com>
Thu, 17 Jul 2025 21:02:44 +0000 (17:02 -0400)
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 <amerey@redhat.com>
libelf/elf_getaroff.c

index 5c102ad6d3541806dd6a1125cab8a54bfdbb7254..5737b35084944f88db34ef9bc36bfbe356b14226 100644 (file)
@@ -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;