summaryrefslogtreecommitdiffstats
path: root/libelf/elf_getarhdr.c
diff options
context:
space:
mode:
authorUlrich Drepper <[email protected]>2008-12-04 05:58:16 +0000
committerUlrich Drepper <[email protected]>2008-12-04 05:58:16 +0000
commit02f66452635df3d01f7e57845c3362ab828e3d89 (patch)
tree24b5255577524d60a33f79596fa1505379d96901 /libelf/elf_getarhdr.c
parent593798821113c57fe10f1fdf6593658d99d05ca9 (diff)
propagate from branch 'com.redhat.elfutils.roland.pending.libelf-threads' (head fc97c9c202b5d7d7699a3b1d5c53007a2ef37bb1)
to branch 'com.redhat.elfutils' (head 67cccb9bfffc1a7fe3d8d355a2d9b6d0e489ff81)
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);