From: Mark Wielaard Date: Fri, 6 Nov 2009 08:14:09 +0000 (+0100) Subject: Mark the archive header as unusable when there is no next ar element. X-Git-Tag: elfutils-0.144~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c6f5e920be3b5672b74707ea52eb95517d620e76;p=thirdparty%2Felfutils.git Mark the archive header as unusable when there is no next ar element. --- diff --git a/libelf/ChangeLog b/libelf/ChangeLog index ba387557c..974afa157 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,8 @@ +2009-11-06 Mark Wielaard + + * elf_next.c (elf_next): Mark the archive header as unusable when + there is no next ar element. + 2009-08-12 Mark Wielaard * Makefile.am (libelf.so): Use -Wl,-z,defs not -defs. diff --git a/libelf/elf_next.c b/libelf/elf_next.c index fbfb27214..dddcb5a7e 100644 --- a/libelf/elf_next.c +++ b/libelf/elf_next.c @@ -84,6 +84,10 @@ elf_next (elf) /* Get the next archive header. */ ret = __libelf_next_arhdr_wrlock (parent) != 0 ? ELF_C_NULL : elf->cmd; + /* If necessary, mark the archive header as unusable. */ + if (ret == ELF_C_NULL) + parent->state.ar.elf_ar_hdr.ar_name = NULL; + rwlock_unlock (parent->lock); return ret;