summaryrefslogtreecommitdiffstats
path: root/libelf/elf_rawfile.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_rawfile.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_rawfile.c')
-rw-r--r--libelf/elf_rawfile.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libelf/elf_rawfile.c b/libelf/elf_rawfile.c
index a1c6a1d2..a62a3549 100644
--- a/libelf/elf_rawfile.c
+++ b/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;
}