From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:58020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qobmw-0004Ny-Ov for qemu-devel@nongnu.org; Wed, 03 Aug 2011 09:47:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qobmv-00024H-UN for qemu-devel@nongnu.org; Wed, 03 Aug 2011 09:47:10 -0400 Message-ID: <4E39514F.6080200@linux.vnet.ibm.com> Date: Wed, 03 Aug 2011 09:46:55 -0400 From: Stefan Berger MIME-Version: 1.0 References: <1312181399-29841-1-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] Check fread() results to avoid gcc 4.6 warnings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org, David Gibson On 08/01/2011 06:19 AM, Stefan Hajnoczi wrote: > On Mon, Aug 1, 2011 at 7:49 AM, David Gibson > wrote: >> When compiling with gcc 4.6, some code in fw_cfg.c complains that fop_ret >> is assigned but not used (which is true). However, it looks like the >> meaningless assignments to fop_ret were done to suppress other gcc warnings >> due to the fact that fread() is labelled as warn_unused_result in glibc. >> >> This patch avoids both errors, by actually checking the fread() result code >> and dropping out with an error message if it fails. >> >> Signed-off-by: David Gibson >> --- >> hw/fw_cfg.c | 13 +++++++++++++ >> 1 files changed, 13 insertions(+), 0 deletions(-) > Reviewed-by: Stefan Hajnoczi > Tested-by: Stefan Berger