summaryrefslogtreecommitdiff
path: root/libdwfl
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2011-03-08 16:26:02 -0800
committerRoland McGrath <roland@redhat.com>2011-03-08 16:26:02 -0800
commite07da4f30d2fabc6e2d4a4bfcc05e02091c99f0a (patch)
tree0f6cd965a374cee426ec9c717b17611ce96e4589 /libdwfl
parent4894221f67d2267f9d701366f257dc2ff44a24c3 (diff)
downloadelfutils-e07da4f30d2fabc6e2d4a4bfcc05e02091c99f0a.tar.gz
libdwfl: Clear errno before using its ambient value.
Diffstat (limited to 'libdwfl')
-rw-r--r--libdwfl/ChangeLog5
-rw-r--r--libdwfl/dwfl_module_getdwarf.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 0cbeb850..3edc11be 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-08 Roland McGrath <roland@redhat.com>
+
+ * dwfl_module_getdwarf.c (open_elf): Clear errno before CBFAIL.
+ Reported by Kurt Roeckx <kurt@roeckx.be>.
+
2011-02-11 Roland McGrath <roland@redhat.com>
* linux-kernel-modules.c (try_kernel_name): Try .gz, .bz2, .xz
diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
index dbb1d604..9c677131 100644
--- a/libdwfl/dwfl_module_getdwarf.c
+++ b/libdwfl/dwfl_module_getdwarf.c
@@ -61,6 +61,10 @@ open_elf (Dwfl_Module *mod, struct dwfl_file *file)
{
if (file->elf == NULL)
{
+ /* CBFAIL uses errno if it's set, so clear it first in case we don't
+ set it with an open failure below. */
+ errno = 0;
+
/* If there was a pre-primed file name left that the callback left
behind, try to open that file name. */
if (file->fd < 0 && file->name != NULL)