summaryrefslogtreecommitdiff
path: root/libdwfl/dwfl_module_getdwarf.c
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/dwfl_module_getdwarf.c
parent4894221f67d2267f9d701366f257dc2ff44a24c3 (diff)
downloadelfutils-e07da4f30d2fabc6e2d4a4bfcc05e02091c99f0a.tar.gz
libdwfl: Clear errno before using its ambient value.
Diffstat (limited to 'libdwfl/dwfl_module_getdwarf.c')
-rw-r--r--libdwfl/dwfl_module_getdwarf.c4
1 files changed, 4 insertions, 0 deletions
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)