diff options
| author | Ulrich Drepper <[email protected]> | 2008-08-16 03:09:13 +0000 |
|---|---|---|
| committer | Ulrich Drepper <[email protected]> | 2008-08-16 03:09:13 +0000 |
| commit | d56e232fb8f8cd97a336ed612c89145ec121f785 (patch) | |
| tree | 5bd8fe5f1f73bb258eecd2cd4dae5c30a33a016e /libelf/elf_getshnum.c | |
| parent | 1d8bb25cac06b5af57f8733e5ea7a068a79edfe0 (diff) | |
propagate from branch 'com.redhat.elfutils.pmachata.threads' (head 8bd3bc10eb015c96f7bafcc6a22c973620b57dd8)
to branch 'com.redhat.elfutils' (head c5a11b6b3329382f1b5ffd0020f0d93c64176f20)
Diffstat (limited to 'libelf/elf_getshnum.c')
| -rw-r--r-- | libelf/elf_getshnum.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libelf/elf_getshnum.c b/libelf/elf_getshnum.c index bf26a9b0..10402d83 100644 --- a/libelf/elf_getshnum.c +++ b/libelf/elf_getshnum.c @@ -60,9 +60,10 @@ int -elf_getshnum (elf, dst) +__elf_getshnum_internal (elf, dst, locked) Elf *elf; size_t *dst; + lockstat_t locked; { int result = 0; int idx; @@ -76,7 +77,8 @@ elf_getshnum (elf, dst) return -1; } - rwlock_rdlock (elf->lock); + if (locked == LS_UNLOCKED) + RWLOCK_RDLOCK (elf->lock); idx = elf->state.elf.scns_last->cnt; if (idx != 0 @@ -90,8 +92,19 @@ elf_getshnum (elf, dst) else *dst = 0; - rwlock_unlock (elf->lock); + if (locked == LS_UNLOCKED) + RWLOCK_UNLOCK (elf->lock); return result; } -INTDEF(elf_getshnum) + +int +elf_getshnum (elf, dst) + Elf *elf; + size_t *dst; +{ + if (elf == NULL) + return -1; + + return __elf_getshnum_internal (elf, dst, LS_UNLOCKED); +} |
