From patchwork Wed Mar 3 12:06:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 46794 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 425ECB7CEC for ; Wed, 3 Mar 2010 23:24:01 +1100 (EST) Received: from localhost ([127.0.0.1]:60328 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nmnao-00034G-Ps for incoming@patchwork.ozlabs.org; Wed, 03 Mar 2010 07:22:22 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NmnMB-0000oB-Hi for qemu-devel@nongnu.org; Wed, 03 Mar 2010 07:07:15 -0500 Received: from [199.232.76.173] (port=53678 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmnMB-0000nt-3S for qemu-devel@nongnu.org; Wed, 03 Mar 2010 07:07:15 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NmnM9-0005Is-LZ for qemu-devel@nongnu.org; Wed, 03 Mar 2010 07:07:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60306) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NmnM8-0005Ii-Hd for qemu-devel@nongnu.org; Wed, 03 Mar 2010 07:07:13 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o23C7BL4023898 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 3 Mar 2010 07:07:11 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o23C71A9004209; Wed, 3 Mar 2010 07:07:09 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 3 Mar 2010 13:06:55 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: kwolf@redhat.com, amit.shah@redhat.com Subject: [Qemu-devel] [PATCH 05/10] vmdk: return errno instead of -1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela --- block/vmdk.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index 56c28a0..5b1d197 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -740,7 +740,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options) fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_LARGEFILE, 0644); if (fd < 0) - return -1; + return -errno; magic = cpu_to_be32(VMDK4_MAGIC); memset(&header, 0, sizeof(header)); header.version = cpu_to_le32(1); @@ -777,18 +777,18 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options) /* write all the data */ ret = qemu_write_full(fd, &magic, sizeof(magic)); if (ret != sizeof(magic)) { - ret = -1; + ret = -errno; goto exit; } ret = qemu_write_full(fd, &header, sizeof(header)); if (ret != sizeof(header)) { - ret = -1; + ret = -errno; goto exit; } ret = ftruncate(fd, header.grain_offset << 9); if (ret < 0) { - ret = -1; + ret = -errno; goto exit; } @@ -798,7 +798,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options) i < gt_count; i++, tmp += gt_size) { ret = qemu_write_full(fd, &tmp, sizeof(tmp)); if (ret != sizeof(tmp)) { - ret = -1; + ret = -errno; goto exit; } } @@ -809,7 +809,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options) i < gt_count; i++, tmp += gt_size) { ret = qemu_write_full(fd, &tmp, sizeof(tmp)); if (ret != sizeof(tmp)) { - ret = -1; + ret = -errno; goto exit; } } @@ -831,7 +831,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options) lseek(fd, le64_to_cpu(header.desc_offset) << 9, SEEK_SET); ret = qemu_write_full(fd, desc, strlen(desc)); if (ret != strlen(desc)) { - ret = -1; + ret = -errno; goto exit; }