From e07da4f30d2fabc6e2d4a4bfcc05e02091c99f0a Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 8 Mar 2011 16:26:02 -0800 Subject: [PATCH] libdwfl: Clear errno before using its ambient value. --- libdwfl/ChangeLog | 5 +++++ libdwfl/dwfl_module_getdwarf.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 0cbeb8502..3edc11bea 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2011-03-08 Roland McGrath + + * dwfl_module_getdwarf.c (open_elf): Clear errno before CBFAIL. + Reported by Kurt Roeckx . + 2011-02-11 Roland McGrath * 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 dbb1d604f..9c6771311 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) -- 2.47.2