aboutsummaryrefslogtreecommitdiff
path: root/gdb/xcoffread.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-08-09 09:58:36 +0930
committerAlan Modra <amodra@gmail.com>2023-08-11 22:16:32 +0930
commit2db20b97f1dc3e5dce3d6ed74a8a62f0dede8c80 (patch)
tree255302b03f963939d9de59310a2e9c6dbe2ee86a /gdb/xcoffread.c
parent19c5c1bb327dbb5c88cd52571896c56296f5a308 (diff)
downloadgdb-2db20b97f1dc3e5dce3d6ed74a8a62f0dede8c80.zip
gdb-2db20b97f1dc3e5dce3d6ed74a8a62f0dede8c80.tar.gz
gdb-2db20b97f1dc3e5dce3d6ed74a8a62f0dede8c80.tar.bz2
gdb: warn unused result for bfd IO functions
This fixes the compilation warnings introduced by my bfdio.c patch. The removed bfd_seeks in coff_symfile_read date back to 1994, commit 7f4c859520, prior to which the file used stdio rather than bfd to read symbols. Since it now uses bfd to read the file there should be no need to synchronise to bfd's idea of the file position. I also fixed a potential uninitialised memory access. Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/xcoffread.c')
-rw-r--r--gdb/xcoffread.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 8ce4b28..63eb538 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -779,8 +779,9 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
while (curoffset <= limit_offset)
{
- bfd_seek (abfd, curoffset, SEEK_SET);
- bfd_read (ext_lnno, linesz, abfd);
+ if (bfd_seek (abfd, curoffset, SEEK_SET) != 0
+ || bfd_read (ext_lnno, linesz, abfd) != linesz)
+ return;
bfd_coff_swap_lineno_in (abfd, ext_lnno, &int_lnno);
/* Find the address this line represents. */