diff options
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; } |
