Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@vmware.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: Pedro Alves <pedro@codesourcery.com>
Subject: [RFA] bfd-target.c, target_bfd_reopen, check for error
Date: Wed, 02 Mar 2011 01:03:00 -0000	[thread overview]
Message-ID: <4D6D9748.7080608@vmware.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 111 bytes --]

This is the only instance in which build_section_table is called
without being checked for error return.

OK?


[-- Attachment #2: reopen.txt --]
[-- Type: text/plain, Size: 893 bytes --]

2011-03-01  Michael Snyder  <msnyder@vmware.com>

	* bfd-target.c (target_bfd_reopen): Check for failure.

Index: bfd-target.c
===================================================================
RCS file: /cvs/src/src/gdb/bfd-target.c,v
retrieving revision 1.17
diff -u -p -u -p -r1.17 bfd-target.c
--- bfd-target.c	1 Jan 2011 15:32:57 -0000	1.17
+++ bfd-target.c	2 Mar 2011 01:00:25 -0000
@@ -85,7 +85,13 @@ target_bfd_reopen (struct bfd *bfd)
 
   data = XZALLOC (struct target_bfd_data);
   data->bfd = bfd;
-  build_section_table (bfd, &data->table.sections, &data->table.sections_end);
+  if (build_section_table (bfd, &data->table.sections,
+			   &data->table.sections_end))
+    {
+      xfree (data);
+      error (_("Failed to re-open '%s': %s"),
+	     bfd_get_filename (bfd), bfd_errmsg (bfd_get_error ()));
+    }
 
   t = XZALLOC (struct target_ops);
   t->to_shortname = "bfd";

             reply	other threads:[~2011-03-02  1:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-02  1:03 Michael Snyder [this message]
2011-03-02  1:26 ` Pedro Alves

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=4D6D9748.7080608@vmware.com \
    --to=msnyder@vmware.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.com \
    /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