[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 04/18] block/cow.c: fix warnings with _FORTIFY_SOURC
From: |
Kirill A. Shutemov |
Subject: |
[Qemu-devel] [PATCH 04/18] block/cow.c: fix warnings with _FORTIFY_SOURCE |
Date: |
Sun, 20 Dec 2009 03:39:13 +0200 |
CC block/cow.o
cc1: warnings being treated as errors
block/cow.c: In function 'cow_create':
block/cow.c:251: error: ignoring return value of 'write', declared with
attribute warn_unused_result
block/cow.c:253: error: ignoring return value of 'ftruncate', declared with
attribute warn_unused_result
make: *** [block/cow.o] Error 1
Signed-off-by: Kirill A. Shutemov <address@hidden>
---
block/cow.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/block/cow.c b/block/cow.c
index a70854e..1132614 100644
--- a/block/cow.c
+++ b/block/cow.c
@@ -209,6 +209,7 @@ static int cow_create(const char *filename,
QEMUOptionParameter *options)
struct stat st;
int64_t image_sectors = 0;
const char *image_filename = NULL;
+ int ret;
/* Read out options */
while (options && options->name) {
@@ -248,11 +249,23 @@ static int cow_create(const char *filename,
QEMUOptionParameter *options)
}
cow_header.sectorsize = cpu_to_be32(512);
cow_header.size = cpu_to_be64(image_sectors * 512);
- write(cow_fd, &cow_header, sizeof(cow_header));
+ ret = write(cow_fd, &cow_header, sizeof(cow_header));
+ if (ret != sizeof(cow_header)) {
+ ret = -errno;
+ goto exit;
+ }
+
/* resize to include at least all the bitmap */
- ftruncate(cow_fd, sizeof(cow_header) + ((image_sectors + 7) >> 3));
+ ret = ftruncate(cow_fd, sizeof(cow_header) + ((image_sectors + 7) >> 3));
+ if (ret) {
+ ret = -errno;
+ goto exit;
+ }
+
+ ret = 0;
+exit:
close(cow_fd);
- return 0;
+ return ret;
}
static void cow_flush(BlockDriverState *bs)
--
1.6.5.6
- [Qemu-devel] [PATCH 01/18] Do not disable _FORTIFY_SOURCE, Kirill A. Shutemov, 2009/12/19
- [Qemu-devel] [PATCH 02/18] block.c: fix warning with _FORTIFY_SOURCE, Kirill A. Shutemov, 2009/12/19
- [Qemu-devel] [PATCH 03/18] posix-aio-compat.c: fix warning with _FORTIFY_SOURCE, Kirill A. Shutemov, 2009/12/19
- [Qemu-devel] [PATCH 04/18] block/cow.c: fix warnings with _FORTIFY_SOURCE,
Kirill A. Shutemov <=
- [Qemu-devel] [PATCH 05/18] block/qcow.c: fix warnings with _FORTIFY_SOURCE, Kirill A. Shutemov, 2009/12/19
- [Qemu-devel] [PATCH 06/18] block/vmdk.o: fix warnings with _FORTIFY_SOURCE, Kirill A. Shutemov, 2009/12/19
- [Qemu-devel] [PATCH 07/18] block/bochs.c: fix warning with _FORTIFY_SOURCE, Kirill A. Shutemov, 2009/12/19
- [Qemu-devel] [PATCH 08/18] block/vvfat.c: fix warnings with _FORTIFY_SOURCE, Kirill A. Shutemov, 2009/12/19
- [Qemu-devel] [PATCH 09/18] block/qcow2.c: fix warnings with _FORTIFY_SOURCE, Kirill A. Shutemov, 2009/12/19
- [Qemu-devel] [PATCH 10/18] net/slirp.c: fix warning with _FORTIFY_SOURCE, Kirill A. Shutemov, 2009/12/19
- [Qemu-devel] [PATCH 11/18] usb-linux.c: fix warning with _FORTIFY_SOURCE, Kirill A. Shutemov, 2009/12/19
- [Qemu-devel] [PATCH 12/18] savevm.c: fix warning with _FORTIFY_SOURCE, Kirill A. Shutemov, 2009/12/19
- [Qemu-devel] [PATCH 13/18] slirp/misc.c: fix warning with _FORTIFY_SOURCE, Kirill A. Shutemov, 2009/12/19
- [Qemu-devel] [PATCH 14/18] vl.c: fix warning with _FORTIFY_SOURCE, Kirill A. Shutemov, 2009/12/19