summaryrefslogtreecommitdiff
path: root/libelf
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2009-11-06 09:14:09 +0100
committerMark Wielaard <mjw@redhat.com>2009-11-06 09:14:09 +0100
commitc6f5e920be3b5672b74707ea52eb95517d620e76 (patch)
tree242f2ce128c28ae55018a13635007de4e3d2cc58 /libelf
parent6229eb57c2708ed0e9b6555cc4301aa496649228 (diff)
downloadelfutils-c6f5e920be3b5672b74707ea52eb95517d620e76.tar.gz
Mark the archive header as unusable when there is no next ar element.
Diffstat (limited to 'libelf')
-rw-r--r--libelf/ChangeLog5
-rw-r--r--libelf/elf_next.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index ba387557..974afa15 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2009-11-06 Mark Wielaard <mjw@redhat.com>
+
+ * elf_next.c (elf_next): Mark the archive header as unusable when
+ there is no next ar element.
+
2009-08-12 Mark Wielaard <mjw@redhat.com>
* Makefile.am (libelf.so): Use -Wl,-z,defs not -defs.
diff --git a/libelf/elf_next.c b/libelf/elf_next.c
index fbfb2721..dddcb5a7 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;