]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix error case in coffread.c
authorTom Tromey <tromey@adacore.com>
Thu, 8 Jan 2026 21:11:08 +0000 (14:11 -0700)
committerTom Tromey <tromey@adacore.com>
Thu, 8 Jan 2026 21:33:07 +0000 (14:33 -0700)
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 <simon.marchi@efficios.com>
gdb/coffread.c

index 54dcc7c765fc69505b46a26a41acbb0b71aec04e..c7b55f37fdb5bdcd556726d539b74cbad6455e33 100644 (file)
@@ -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 ();