Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Subject: [patch] check return value of do_write in sim_load_file()
Date: Thu, 04 Feb 2010 07:07:00 -0000	[thread overview]
Message-ID: <201002040207.39493.vapier@gentoo.org> (raw)

[-- Attachment #1: Type: Text/Plain, Size: 979 bytes --]

if the do_write function (which is the real meat of sim_load_file()) fails, 
nothing is displayed in the load output to indicate a problem.  so check the 
return value before declaring everything peachy.

2010-02-04  Mike Frysinger  <vapier@gentoo.org>

	* sim-load.c (sim_load_file): Check do_write() return value.

RCS file: /cvs/src/src/sim/common/sim-load.c,v
retrieving revision 1.14
diff -u -p -r1.14 sim-load.c
--- sim/common/sim-load.c	1 Jan 2010 10:03:27 -0000	1.14
+++ sim/common/sim-load.c	4 Feb 2010 07:02:42 -0000
@@ -140,8 +140,10 @@ sim_load_file (sd, myname, callback, pro
 		}
 	      data_count += size;
 	      bfd_get_section_contents (result_bfd, s, buffer, 0, size);
-	      do_write (sd, lma, buffer, size);
-	      found_loadable_section = 1;
+	      if (do_write (sd, lma, buffer, size) != size)
+		eprintf (callback, "\tloading section failed\n");
+	      else
+		found_loadable_section = 1;
 	      free (buffer);
 	    }
 	}

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

             reply	other threads:[~2010-02-04  7:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-04  7:07 Mike Frysinger [this message]
2010-02-04 21:58 ` Doug Evans
2010-02-05  0:18   ` Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201002040207.39493.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox