hw/pc.c: fix warnings with _FORTIFY_SOURCE

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 <kirill@shutemov.name>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Kirill A. Shutemov 2009-12-25 18:19:17 +00:00 committed by Blue Swirl
parent 34ba360fda
commit 5a41ecc5f2

15
hw/pc.c
View File

@ -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));