diff options
author | Kirill A. Shutemov <kirill@shutemov.name> | 2009-12-25 18:19:17 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2009-12-25 18:19:17 +0000 |
commit | 5a41ecc5f28bc434e8f3b5868c9481ad423ae664 (patch) | |
tree | 9befd271a843cb495804884cb68f874ae313f0bd | |
parent | 34ba360fda5853d97fa69af00a5d510a786d41b3 (diff) |
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>
-rw-r--r-- | hw/pc.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -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)); |