From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22823 invoked by alias); 4 Feb 2010 07:07:12 -0000 Received: (qmail 22804 invoked by uid 22791); 4 Feb 2010 07:07:10 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Feb 2010 07:07:06 +0000 Received: from vapier.localnet (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id C0CAB1B4037 for ; Thu, 4 Feb 2010 07:07:04 +0000 (UTC) From: Mike Frysinger 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 User-Agent: KMail/1.12.4 (Linux/2.6.32.6; KDE/4.3.4; x86_64; ; ) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2245293.0tEspP83LL"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201002040207.39493.vapier@gentoo.org> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-02/txt/msg00104.txt.bz2 --nextPart2245293.0tEspP83LL Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-length: 969 if the do_write function (which is the real meat of sim_load_file()) fails,= =20 nothing is displayed in the load output to indicate a problem. so check th= e=20 return value before declaring everything peachy. 2010-02-04 Mike Frysinger * 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 +=3D size; bfd_get_section_contents (result_bfd, s, buffer, 0, size); - do_write (sd, lma, buffer, size); - found_loadable_section =3D 1; + if (do_write (sd, lma, buffer, size) !=3D size) + eprintf (callback, "\tloading section failed\n"); + else + found_loadable_section =3D 1; free (buffer); } } --nextPart2245293.0tEspP83LL Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. Content-length: 836 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iQIcBAABAgAGBQJLanI7AAoJEEFjO5/oN/WBd8gP/3oxLpoLYDrgatkBSoY8xuiu Cz+6Sjhgd5i7Yevp0vyTX44CPCC+vGivX04I+A+TMyH4mt4kLziTjiOfWxjE7Vt7 MTnuSrJfToOnoZrbWibqvcVLrJmLcX8+z3G8riNuIX8qaw2NPNZdztJ5DlJrBOpI Z+SOuGxjeajufMQ+Df5fhSftpnhggAXn7RLUJhjzgdqS0/KRRy0p3qByGPnN1Ow5 CX86HptXCaqglJz9KlXu9dAG1ABwsxVw5AU4IR8pLJ+s6Pe15a4MEVZpwv9nRejF JFu0AgYZmbHqt+uFFtx34wbbf1q6JblqedgnjWRywPn/f2CzzAYRdbI/f08d/Q0U BkA4wsTptZLDXjniMsOL4XaOt8+6AOXNAoL2i3wiZcjvIPtp41qGq+kKeYLPRgKW DsDvvnVaANbw4AY+GkPoDjV1tRYuzqZT1lVUacZkBwFbHPY0hxz7XTIo+VKNtSb8 bED3gfbrgruyXMcE3HtR+JiwR2LxvWocZ5v3m/w+hL90CYmE4kqOusuRJiVthiRK EOh1pdpgU8dwl3Xn6rBR2IDzIy+NJo871Gn5irLzWwiqpaKze4v2iKzokmF7vH9F o8ap2o/a5dEC+8U+rHiyy6ngVBGoXl+/qLz6ge8zpDLRGspGaAGdDEe3NquT2kfm SXHjSLPX4KA1phDp84SW =VFZq -----END PGP SIGNATURE----- --nextPart2245293.0tEspP83LL--