summaryrefslogtreecommitdiffstats
path: root/libelf/elf_strptr.c
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2008-08-25 22:55:17 +0000
committerRoland McGrath <[email protected]>2008-08-25 22:55:17 +0000
commitb4d6f0f8064f2b706ea9035ef0393d8299671390 (patch)
tree58d3da51253302bc5b8f2198d8462942ff43f464 /libelf/elf_strptr.c
parentf729d77881262094d365d33ac51063e25a02e357 (diff)
Fix up bogon and missing log entries from .pmachata.threads branch.
Diffstat (limited to 'libelf/elf_strptr.c')
-rw-r--r--libelf/elf_strptr.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/libelf/elf_strptr.c b/libelf/elf_strptr.c
index 6fb0c50c..35a0e9b6 100644
--- a/libelf/elf_strptr.c
+++ b/libelf/elf_strptr.c
@@ -73,7 +73,7 @@ elf_strptr (elf, idx, offset)
return NULL;
}
- RWLOCK_RDLOCK (elf->lock);
+ rwlock_rdlock (elf->lock);
char *result = NULL;
Elf_Scn *strscn;
@@ -140,10 +140,15 @@ elf_strptr (elf, idx, offset)
}
}
- if (strscn->rawdata_base == NULL && ! strscn->data_read
- /* Read the section data. */
- && __libelf_set_rawdata (strscn, LS_RDLOCKED) != 0)
- goto out;
+ if (strscn->rawdata_base == NULL && ! strscn->data_read)
+ {
+ rwlock_unlock (elf->lock);
+ rwlock_wrlock (elf->lock);
+ if (strscn->rawdata_base == NULL && ! strscn->data_read
+ /* Read the section data. */
+ && __libelf_set_rawdata_wrlock (strscn) != 0)
+ goto out;
+ }
if (likely (strscn->rawdata_base != NULL))
result = &strscn->rawdata_base[offset];
@@ -166,7 +171,7 @@ elf_strptr (elf, idx, offset)
}
out:
- RWLOCK_UNLOCK (elf->lock);
+ rwlock_unlock (elf->lock);
return result;
}