summaryrefslogtreecommitdiffstats
path: root/libelf/elf_getarhdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'libelf/elf_getarhdr.c')
-rw-r--r--libelf/elf_getarhdr.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libelf/elf_getarhdr.c b/libelf/elf_getarhdr.c
index 875b2a10..6cc6eddb 100644
--- a/libelf/elf_getarhdr.c
+++ b/libelf/elf_getarhdr.c
@@ -78,8 +78,15 @@ elf_getarhdr (elf)
/* Make sure we have read the archive header. */
if (parent->state.ar.elf_ar_hdr.ar_name == NULL
&& __libelf_next_arhdr (parent) != 0)
- /* Something went wrong. Maybe there is no member left. */
- return NULL;
+ {
+ rwlock_wrlock (parent->lock);
+ int st = __libelf_next_arhdr_wrlock (parent);
+ rwlock_unlock (parent->lock);
+
+ if (st != 0)
+ /* Something went wrong. Maybe there is no member left. */
+ return NULL;
+ }
/* We can be sure the parent is an archive. */
assert (parent->kind == ELF_K_AR);