summaryrefslogtreecommitdiff
path: root/elfutils/libelf/elf_rawfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'elfutils/libelf/elf_rawfile.c')
-rw-r--r--elfutils/libelf/elf_rawfile.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/elfutils/libelf/elf_rawfile.c b/elfutils/libelf/elf_rawfile.c
index a1c6a1d2..a62a3549 100644
--- a/elfutils/libelf/elf_rawfile.c
+++ b/elfutils/libelf/elf_rawfile.c
@@ -63,6 +63,8 @@ elf_rawfile (elf, ptr)
Elf *elf;
size_t *ptr;
{
+ char *result;
+
if (elf == NULL)
{
/* No valid descriptor. */
@@ -77,8 +79,12 @@ elf_rawfile (elf, ptr)
if (elf->map_address == NULL && __libelf_readall (elf) == NULL)
goto error_out;
+ rwlock_rdlock (elf->lock);
if (ptr != NULL)
*ptr = elf->maximum_size;
- return (char *) elf->map_address + elf->start_offset;
+ result = (char *) elf->map_address + elf->start_offset;
+ rwlock_unlock (elf->lock);
+
+ return result;
}