OSDN Git Service

Check fread() results to avoid gcc 4.6 warnings
authorDavid Gibson <david@gibson.dropbear.id.au>
Mon, 1 Aug 2011 06:49:59 +0000 (16:49 +1000)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 5 Aug 2011 15:57:34 +0000 (10:57 -0500)
commit257a7375582e4c3b32687c72d0f52279d28b2d85
treebe0ea143ef397130589e1ce17ccf2044e9c6d0a3
parent8a6b0cd7642f6a69700ef5c082b750140d61b7f4
Check fread() results to avoid gcc 4.6 warnings

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.

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/fw_cfg.c