aboutsummaryrefslogtreecommitdiff
path: root/block/qcow.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2010-03-04 10:00:33 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2010-03-09 11:23:00 -0600
commit98c2b2f4371f9a496c0dc479d7f86b086de3b4e0 (patch)
tree329baaf131e9c419fa09ef22fde9e0f076a28e47 /block/qcow.c
parentbef57da55ccaa468207ebeef01519ff29fc34d90 (diff)
downloadqemu-98c2b2f4371f9a496c0dc479d7f86b086de3b4e0.zip
qemu-98c2b2f4371f9a496c0dc479d7f86b086de3b4e0.tar.gz
qemu-98c2b2f4371f9a496c0dc479d7f86b086de3b4e0.tar.bz2
qcow: 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/qcow.c')
-rw-r--r--block/qcow.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/block/qcow.c b/block/qcow.c
index 003db1e..c619984 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -766,7 +766,7 @@ static int qcow_create(const char *filename, QEMUOptionParameter *options)
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);
@@ -804,14 +804,14 @@ static int qcow_create(const char *filename, QEMUOptionParameter *options)
/* 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) {
ret = qemu_write_full(fd, backing_file, backing_filename_len);
if (ret != backing_filename_len) {
- ret = -1;
+ ret = -errno;
goto exit;
}
@@ -821,7 +821,7 @@ static int qcow_create(const char *filename, QEMUOptionParameter *options)
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;
}
}