From: Tom Tromey Date: Thu, 8 Jan 2026 21:11:08 +0000 (-0700) Subject: Fix error case in coffread.c X-Git-Tag: binutils-2_46~379 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7a5af285bb7ce4cf6bbf0d82b26be700dbabba91;p=thirdparty%2Fbinutils-gdb.git Fix error case in coffread.c coffread.c is the last spot (that I know of) that incorrectly calls perror_with_name when a BFD function fails. The issue here is that perror_with_name examines errno, but BFD failures do not set this. This patch changes this to use error and bfd_errmsg. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31041 Approved-By: Simon Marchi --- diff --git a/gdb/coffread.c b/gdb/coffread.c index 54dcc7c765f..c7b55f37fdb 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -761,7 +761,8 @@ coff_symtab_read (minimal_symbol_reader &reader, /* Position to read the symbol table. */ val = bfd_seek (objfile->obfd.get (), symtab_offset, 0); if (val < 0) - perror_with_name (objfile_name (objfile)); + error (_("Error reading symbols from %s: %s"), + objfile_name (objfile), bfd_errmsg (bfd_get_error ())); coffread_objfile = objfile; nlist_bfd_global = objfile->obfd.get ();