summaryrefslogtreecommitdiffstats
path: root/libelf/elf32_getehdr.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/elf32_getehdr.c
parentf729d77881262094d365d33ac51063e25a02e357 (diff)
Fix up bogon and missing log entries from .pmachata.threads branch.
Diffstat (limited to 'libelf/elf32_getehdr.c')
-rw-r--r--libelf/elf32_getehdr.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/libelf/elf32_getehdr.c b/libelf/elf32_getehdr.c
index e5c218a7..d62e255b 100644
--- a/libelf/elf32_getehdr.c
+++ b/libelf/elf32_getehdr.c
@@ -63,9 +63,8 @@
ElfW2(LIBELFBITS,Ehdr) *
-__elfw2(LIBELFBITS,getehdr_internal) (elf, locked)
+__elfw2(LIBELFBITS,getehdr_rdlock) (elf)
Elf *elf;
- lockstat_t locked;
{
ElfW2(LIBELFBITS,Ehdr) *result;
@@ -78,9 +77,6 @@ __elfw2(LIBELFBITS,getehdr_internal) (elf, locked)
return NULL;
}
- if (locked == LS_UNLOCKED)
- RWLOCK_RDLOCK (elf->lock);
-
if (elf->class == 0)
elf->class = ELFW(ELFCLASS,LIBELFBITS);
else if (unlikely (elf->class != ELFW(ELFCLASS,LIBELFBITS)))
@@ -93,9 +89,6 @@ __elfw2(LIBELFBITS,getehdr_internal) (elf, locked)
result = elf->state.ELFW(elf,LIBELFBITS).ehdr;
out:
- if (locked == LS_UNLOCKED)
- RWLOCK_UNLOCK (elf->lock);
-
return result;
}
@@ -103,8 +96,13 @@ ElfW2(LIBELFBITS,Ehdr) *
elfw2(LIBELFBITS,getehdr) (elf)
Elf *elf;
{
+ ElfW2(LIBELFBITS,Ehdr) *result;
if (elf == NULL)
return NULL;
- return __elfw2(LIBELFBITS,getehdr_internal) (elf, LS_UNLOCKED);
+ rwlock_rdlock (elf->lock);
+ result = __elfw2(LIBELFBITS,getehdr_rdlock) (elf);
+ rwlock_unlock (elf->lock);
+
+ return result;
}