summaryrefslogtreecommitdiffstats
path: root/libelf/gelf_getphdr.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/gelf_getphdr.c
parentf729d77881262094d365d33ac51063e25a02e357 (diff)
Fix up bogon and missing log entries from .pmachata.threads branch.
Diffstat (limited to 'libelf/gelf_getphdr.c')
-rw-r--r--libelf/gelf_getphdr.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/libelf/gelf_getphdr.c b/libelf/gelf_getphdr.c
index 286b253e..66cd143d 100644
--- a/libelf/gelf_getphdr.c
+++ b/libelf/gelf_getphdr.c
@@ -54,6 +54,7 @@
#include <gelf.h>
#include <string.h>
+#include <stdbool.h>
#include "libelfP.h"
@@ -81,7 +82,7 @@ gelf_getphdr (elf, ndx, dst)
return NULL;
}
- RWLOCK_RDLOCK (elf->lock);
+ rwlock_rdlock (elf->lock);
if (elf->class == ELFCLASS32)
{
@@ -90,10 +91,12 @@ gelf_getphdr (elf, ndx, dst)
if (phdr == NULL)
{
- phdr = __elf32_getphdr_internal (elf, LS_RDLOCKED);
+ rwlock_unlock (elf->lock);
+ phdr = INTUSE(elf32_getphdr) (elf);
if (phdr == NULL)
/* The error number is already set. */
- goto out;
+ return NULL;
+ rwlock_rdlock (elf->lock);
}
/* Test whether the index is ok. */
@@ -126,10 +129,12 @@ gelf_getphdr (elf, ndx, dst)
if (phdr == NULL)
{
- phdr = __elf64_getphdr_internal (elf, LS_RDLOCKED);
+ rwlock_unlock (elf->lock);
+ phdr = INTUSE(elf64_getphdr) (elf);
if (phdr == NULL)
/* The error number is already set. */
- goto out;
+ return NULL;
+ rwlock_rdlock (elf->lock);
}
/* Test whether the index is ok. */
@@ -144,7 +149,7 @@ gelf_getphdr (elf, ndx, dst)
}
out:
- RWLOCK_UNLOCK (elf->lock);
+ rwlock_unlock (elf->lock);
return result;
}