On Sun, Dec 20, 2009 at 1:39 AM, Kirill A. Shutemov <kir...@shutemov.name> wrote: > CC i386-softmmu/pc.o > cc1: warnings being treated as errors > /usr/src/RPM/BUILD/qemu-0.11.92/hw/pc.c: In function 'load_multiboot': > /usr/src/RPM/BUILD/qemu-0.11.92/hw/pc.c:614: error: ignoring return value of > 'fread', declared with attribute warn_unused_result > /usr/src/RPM/BUILD/qemu-0.11.92/hw/pc.c: In function 'load_linux': > /usr/src/RPM/BUILD/qemu-0.11.92/hw/pc.c:888: error: ignoring return value of > 'fread', declared with attribute warn_unused_result > /usr/src/RPM/BUILD/qemu-0.11.92/hw/pc.c:889: error: ignoring return value of > 'fread', declared with attribute warn_unused_result > make[1]: *** [pc.o] Error 1 > > Signed-off-by: Kirill A. Shutemov <kir...@shutemov.name> > --- > hw/pc.c | 15 ++++++++++++--- > 1 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/hw/pc.c b/hw/pc.c > index db7d58e..83f8dd0 100644 > --- a/hw/pc.c > +++ b/hw/pc.c > @@ -613,7 +613,10 @@ static int load_multiboot(void *fw_cfg, > > mb_kernel_data = qemu_malloc(mb_kernel_size); > fseek(f, mb_kernel_text_offset, SEEK_SET); > - fread(mb_kernel_data, 1, mb_kernel_size, f); > + if (fread(mb_kernel_data, 1, mb_kernel_size, f) != mb_kernel_size) { > + fprintf(stderr, "fread() failed\n"); > + exit(1); > + } > fclose(f); > } > > @@ -887,8 +890,14 @@ static void load_linux(void *fw_cfg, > setup = qemu_malloc(setup_size); > kernel = qemu_malloc(kernel_size); > fseek(f, 0, SEEK_SET); > - fread(setup, 1, setup_size, f); > - fread(kernel, 1, kernel_size, f); > + if (fread(setup, 1, setup_size, f) != setup_size) { > + fprintf(stderr, "fread() failed\n"); > + exit(1); > + } > + if (fread(kernel, 1, kernel_size, f) != kernel_size) { > + fprintf(stderr, "fread() failed\n"); > + exit(1); > + } > fclose(f); > memcpy(setup, header, MIN(sizeof(header), setup_size));
Looks fine to me. If we can't read the kernel, PEBCAK.