aboutsummaryrefslogtreecommitdiff
path: root/block/qcow2.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2010-03-04 10:00:32 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2010-03-09 11:23:00 -0600
commitbef57da55ccaa468207ebeef01519ff29fc34d90 (patch)
treed577f0ebadbb1ffdcf00980e5190d77f19ec615c /block/qcow2.c
parent24ac07dec7f23c58dc48aa7754f872781b386d46 (diff)
qcow2: return errno instead of -1
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'block/qcow2.c')
-rw-r--r--block/qcow2.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/block/qcow2.c b/block/qcow2.c
index bf8170ed02..5b6dad9d59 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -851,7 +851,7 @@ static int qcow_create2(const char *filename, int64_t total_size,
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
if (fd < 0)
- return -1;
+ return -errno;
memset(&header, 0, sizeof(header));
header.magic = cpu_to_be32(QCOW_MAGIC);
header.version = cpu_to_be32(QCOW_VERSION);
@@ -930,7 +930,7 @@ static int qcow_create2(const char *filename, int64_t total_size,
/* write all the data */
ret = qemu_write_full(fd, &header, sizeof(header));
if (ret != sizeof(header)) {
- ret = -1;
+ ret = -errno;
goto exit;
}
if (backing_file) {
@@ -943,25 +943,25 @@ static int qcow_create2(const char *filename, int64_t total_size,
cpu_to_be32s(&ext_bf.len);
ret = qemu_write_full(fd, &ext_bf, sizeof(ext_bf));
if (ret != sizeof(ext_bf)) {
- ret = -1;
+ ret = -errno;
goto exit;
}
ret = qemu_write_full(fd, backing_format, backing_format_len);
if (ret != backing_format_len) {
- ret = -1;
+ ret = -errno;
goto exit;
}
if (padding > 0) {
ret = qemu_write_full(fd, zero, padding);
if (ret != padding) {
- ret = -1;
+ ret = -errno;
goto exit;
}
}
}
ret = qemu_write_full(fd, backing_file, backing_filename_len);
if (ret != backing_filename_len) {
- ret = -1;
+ ret = -errno;
goto exit;
}
}
@@ -970,14 +970,14 @@ static int qcow_create2(const char *filename, int64_t total_size,
for(i = 0;i < l1_size; i++) {
ret = qemu_write_full(fd, &tmp, sizeof(tmp));
if (ret != sizeof(tmp)) {
- ret = -1;
+ ret = -errno;
goto exit;
}
}
lseek(fd, s->refcount_table_offset, SEEK_SET);
ret = qemu_write_full(fd, s->refcount_table, s->cluster_size);
if (ret != s->cluster_size) {
- ret = -1;
+ ret = -errno;
goto exit;
}
@@ -985,7 +985,7 @@ static int qcow_create2(const char *filename, int64_t total_size,
ret = qemu_write_full(fd, s->refcount_block,
ref_clusters * s->cluster_size);
if (ret != ref_clusters * s->cluster_size) {
- ret = -1;
+ ret = -errno;
goto exit;
}