[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/17] block/qcow.c: fix warnings with _FORTIFY_SOUR
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 05/17] block/qcow.c: fix warnings with _FORTIFY_SOURCE |
Date: |
Wed, 20 Jan 2010 00:56:12 +0100 |
From: Kirill A. Shutemov <address@hidden>
CC block/qcow.o
cc1: warnings being treated as errors
block/qcow.c: In function 'qcow_create':
block/qcow.c:804: error: ignoring return value of 'write', declared with
attribute warn_unused_result
block/qcow.c:806: error: ignoring return value of 'write', declared with
attribute warn_unused_result
block/qcow.c:811: error: ignoring return value of 'write', declared with
attribute warn_unused_result
make: *** [block/qcow.o] Error 1
Signed-off-by: Kirill A. Shutemov <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>
---
block/qcow.c | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/block/qcow.c b/block/qcow.c
index 1e3e59b..003db1e 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -750,6 +750,7 @@ static int qcow_create(const char *filename,
QEMUOptionParameter *options)
int64_t total_size = 0;
const char *backing_file = NULL;
int flags = 0;
+ int ret;
/* Read out options */
while (options && options->name) {
@@ -801,17 +802,34 @@ static int qcow_create(const char *filename,
QEMUOptionParameter *options)
}
/* write all the data */
- write(fd, &header, sizeof(header));
+ ret = qemu_write_full(fd, &header, sizeof(header));
+ if (ret != sizeof(header)) {
+ ret = -1;
+ goto exit;
+ }
+
if (backing_file) {
- write(fd, backing_file, backing_filename_len);
+ ret = qemu_write_full(fd, backing_file, backing_filename_len);
+ if (ret != backing_filename_len) {
+ ret = -1;
+ goto exit;
+ }
+
}
lseek(fd, header_size, SEEK_SET);
tmp = 0;
for(i = 0;i < l1_size; i++) {
- write(fd, &tmp, sizeof(tmp));
+ ret = qemu_write_full(fd, &tmp, sizeof(tmp));
+ if (ret != sizeof(tmp)) {
+ ret = -1;
+ goto exit;
+ }
}
+
+ ret = 0;
+exit:
close(fd);
- return 0;
+ return ret;
}
static int qcow_make_empty(BlockDriverState *bs)
--
1.6.5.2
- [Qemu-devel] [PATCH 00/17] Fix compilation with _FORTIFY_SOURCE, Juan Quintela, 2010/01/19
- [Qemu-devel] [PATCH 01/17] Introduce qemu_write_full(), Juan Quintela, 2010/01/19
- [Qemu-devel] [PATCH 02/17] force to test result for qemu_write_full(), Juan Quintela, 2010/01/19
- [Qemu-devel] [PATCH 03/17] posix-aio-compat.c: fix warning with _FORTIFY_SOURCE, Juan Quintela, 2010/01/19
- [Qemu-devel] [PATCH 04/17] block/cow.c: fix warnings with _FORTIFY_SOURCE, Juan Quintela, 2010/01/19
- [Qemu-devel] [PATCH 05/17] block/qcow.c: fix warnings with _FORTIFY_SOURCE,
Juan Quintela <=
- [Qemu-devel] [PATCH 06/17] block/vmdk.o: fix warnings with _FORTIFY_SOURCE, Juan Quintela, 2010/01/19
- [Qemu-devel] [PATCH 07/17] block/vvfat.c: fix warnings with _FORTIFY_SOURCE, Juan Quintela, 2010/01/19
- [Qemu-devel] Re: [PATCH 07/17] block/vvfat.c: fix warnings with _FORTIFY_SOURCE, Kirill A. Shutemov, 2010/01/20
- Re: [Qemu-devel] Re: [PATCH 07/17] block/vvfat.c: fix warnings with _FORTIFY_SOURCE, Daniel P. Berrange, 2010/01/20
- Re: [Qemu-devel] Re: [PATCH 07/17] block/vvfat.c: fix warnings with _FORTIFY_SOURCE, Kirill A. Shutemov, 2010/01/20
- Re: [Qemu-devel] Re: [PATCH 07/17] block/vvfat.c: fix warnings with _FORTIFY_SOURCE, Kevin Wolf, 2010/01/20
- Re: [Qemu-devel] Re: [PATCH 07/17] block/vvfat.c: fix warnings with _FORTIFY_SOURCE, Markus Armbruster, 2010/01/20
- Re: [Qemu-devel] Re: [PATCH 07/17] block/vvfat.c: fix warnings with _FORTIFY_SOURCE, Kirill A. Shutemov, 2010/01/20
- Re: [Qemu-devel] Re: [PATCH 07/17] block/vvfat.c: fix warnings with _FORTIFY_SOURCE, Markus Armbruster, 2010/01/20
- Re: [Qemu-devel] Re: [PATCH 07/17] block/vvfat.c: fix warnings with _FORTIFY_SOURCE, Gleb Natapov, 2010/01/20