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_rand.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_rand.c')
| -rw-r--r-- | libelf/elf_rand.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libelf/elf_rand.c b/libelf/elf_rand.c index 9ba631ff..a766d38f 100644 --- a/libelf/elf_rand.c +++ b/libelf/elf_rand.c @@ -67,16 +67,20 @@ elf_rand (elf, offset) if (elf == NULL || elf->kind != ELF_K_AR) return 0; + rwlock_wrlock (elf->lock); + /* Save the old offset and set the offset. */ elf->state.ar.offset = elf->start_offset + offset; /* Get the next archive header. */ - if (__libelf_next_arhdr (elf) != 0) + if (__libelf_next_arhdr_wrlock (elf) != 0) { /* Mark the archive header as unusable. */ elf->state.ar.elf_ar_hdr.ar_name = NULL; return 0; } + rwlock_unlock (elf->lock); + return offset; } |
