diff options
| author | Ulrich Drepper <[email protected]> | 2008-12-04 05:58:16 +0000 |
|---|---|---|
| committer | Ulrich Drepper <[email protected]> | 2008-12-04 05:58:16 +0000 |
| commit | 02f66452635df3d01f7e57845c3362ab828e3d89 (patch) | |
| tree | 24b5255577524d60a33f79596fa1505379d96901 /libelf/elf_next.c | |
| parent | 593798821113c57fe10f1fdf6593658d99d05ca9 (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_next.c')
| -rw-r--r-- | libelf/elf_next.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libelf/elf_next.c b/libelf/elf_next.c index ec80fadf..fbfb2721 100644 --- a/libelf/elf_next.c +++ b/libelf/elf_next.c @@ -64,6 +64,7 @@ elf_next (elf) Elf *elf; { Elf *parent; + Elf_Cmd ret; /* Be gratious, the specs demand it. */ if (elf == NULL || elf->parent == NULL) @@ -73,14 +74,17 @@ elf_next (elf) parent = elf->parent; assert (parent->kind == ELF_K_AR); + rwlock_wrlock (parent->lock); + /* Now advance the offset. */ parent->state.ar.offset += (sizeof (struct ar_hdr) + ((parent->state.ar.elf_ar_hdr.ar_size + 1) & ~1l)); /* Get the next archive header. */ - if (__libelf_next_arhdr (parent) != 0) - return ELF_C_NULL; + ret = __libelf_next_arhdr_wrlock (parent) != 0 ? ELF_C_NULL : elf->cmd; + + rwlock_unlock (parent->lock); - return elf->cmd; + return ret; } |
