Fix: .../tests/bios-tables-test.c: In function 'main': .../tests/bios-tables-test.c:796:11: error: ignoring return value of 'fwrite', declared with attribute warn_unused_result [-Werror=unused-result] cc1: all warnings being treated as errors make: *** [tests/bios-tables-test.o] Error 1
happening when building QEMU with the `--enable-werror' configuration option present. Report any failure from `fwrite'. Signed-off-by: Maciej W. Rozycki <ma...@codesourcery.com> --- qemu-test-bios-tables-fwrite.diff Index: qemu-git-trunk/tests/bios-tables-test.c =================================================================== --- qemu-git-trunk.orig/tests/bios-tables-test.c 2014-11-21 11:56:04.000000000 +0000 +++ qemu-git-trunk/tests/bios-tables-test.c 2014-12-02 15:52:27.868971680 +0000 @@ -787,14 +787,21 @@ int main(int argc, char *argv[]) { const char *arch = qtest_get_arch(); FILE *f = fopen(disk, "w"); + size_t s; + int err; int ret; if (!f) { fprintf(stderr, "Couldn't open \"%s\": %s", disk, strerror(errno)); return 1; } - fwrite(boot_sector, 1, sizeof boot_sector, f); + s = fwrite(boot_sector, 1, sizeof boot_sector, f); + err = errno; fclose(f); + if (s != sizeof boot_sector) { + fprintf(stderr, "Couldn't write \"%s\": %s", disk, strerror(err)); + return 1; + } g_test_init(&argc, &argv, NULL);