From: Roland McGrath Date: Wed, 9 Mar 2011 00:26:02 +0000 (-0800) Subject: libdwfl: Clear errno before using its ambient value. X-Git-Tag: elfutils-0.153~62 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e07da4f30d2fabc6e2d4a4bfcc05e02091c99f0a;p=thirdparty%2Felfutils.git libdwfl: Clear errno before using its ambient value. --- 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)