From dc27975e81d268bdc61deae2b5b679404e467ab9 Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Thu, 4 Mar 2010 23:11:48 -0300 Subject: [PATCH 26/42] qcow: return errno instead of -1 RH-Author: Juan Quintela Message-id: <391e3f4fa6fe867d41f08c2f0c048e4ce97eab90.1267743950.git.quintela@redhat.com> Patchwork-id: 7555 O-Subject: [PATCH 26/32] qcow: return errno instead of -1 Bugzilla: 567099 RH-Acked-by: Kevin Wolf RH-Acked-by: Amit Shah RH-Acked-by: Marcelo Tosatti Signed-off-by: Juan Quintela --- block/qcow.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Signed-off-by: Eduardo Habkost --- block/qcow.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/block/qcow.c b/block/qcow.c index 0ac83c8..e4cab98 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; } } -- 1.6.3.rc4.29.g8146