diff options
author | Ulrich Drepper <drepper@redhat.com> | 2008-08-16 03:09:13 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2008-08-16 03:09:13 +0000 |
commit | d56e232fb8f8cd97a336ed612c89145ec121f785 (patch) | |
tree | 5bd8fe5f1f73bb258eecd2cd4dae5c30a33a016e /libelf/elf32_getehdr.c | |
parent | 1d8bb25cac06b5af57f8733e5ea7a068a79edfe0 (diff) | |
download | elfutils-d56e232fb8f8cd97a336ed612c89145ec121f785.tar.gz |
propagate from branch 'com.redhat.elfutils.pmachata.threads' (head 8bd3bc10eb015c96f7bafcc6a22c973620b57dd8)
to branch 'com.redhat.elfutils' (head c5a11b6b3329382f1b5ffd0020f0d93c64176f20)
Diffstat (limited to 'libelf/elf32_getehdr.c')
-rw-r--r-- | libelf/elf32_getehdr.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/libelf/elf32_getehdr.c b/libelf/elf32_getehdr.c index bdb2cc41..e5c218a7 100644 --- a/libelf/elf32_getehdr.c +++ b/libelf/elf32_getehdr.c @@ -63,8 +63,9 @@ ElfW2(LIBELFBITS,Ehdr) * -elfw2(LIBELFBITS,getehdr) (elf) +__elfw2(LIBELFBITS,getehdr_internal) (elf, locked) Elf *elf; + lockstat_t locked; { ElfW2(LIBELFBITS,Ehdr) *result; @@ -77,7 +78,8 @@ elfw2(LIBELFBITS,getehdr) (elf) return NULL; } - rwlock_rdlock (elf->lock); + if (locked == LS_UNLOCKED) + RWLOCK_RDLOCK (elf->lock); if (elf->class == 0) elf->class = ELFW(ELFCLASS,LIBELFBITS); @@ -91,8 +93,18 @@ elfw2(LIBELFBITS,getehdr) (elf) result = elf->state.ELFW(elf,LIBELFBITS).ehdr; out: - rwlock_unlock (elf->lock); + if (locked == LS_UNLOCKED) + RWLOCK_UNLOCK (elf->lock); return result; } -INTDEF(elfw2(LIBELFBITS,getehdr)) + +ElfW2(LIBELFBITS,Ehdr) * +elfw2(LIBELFBITS,getehdr) (elf) + Elf *elf; +{ + if (elf == NULL) + return NULL; + + return __elfw2(LIBELFBITS,getehdr_internal) (elf, LS_UNLOCKED); +} |