From patchwork Thu Mar 4 09:00:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 46895 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 A9576B7CE6 for ; Thu, 4 Mar 2010 20:22:35 +1100 (EST) Received: from localhost ([127.0.0.1]:47017 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nn7FR-0006f8-Sv for incoming@patchwork.ozlabs.org; Thu, 04 Mar 2010 04:21:37 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nn6vQ-0003sK-8N for qemu-devel@nongnu.org; Thu, 04 Mar 2010 04:00:56 -0500 Received: from [199.232.76.173] (port=45409 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nn6vP-0003rr-2D for qemu-devel@nongnu.org; Thu, 04 Mar 2010 04:00:55 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nn6vM-0004SD-RY for qemu-devel@nongnu.org; Thu, 04 Mar 2010 04:00:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:15020) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nn6vL-0004Rk-HA for qemu-devel@nongnu.org; Thu, 04 Mar 2010 04:00:52 -0500 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2490nEW003796 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 4 Mar 2010 04:00:49 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2490etX010016; Thu, 4 Mar 2010 04:00:47 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 4 Mar 2010 10:00:33 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 04/10] qcow: 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/qcow.c | 8 ++++---- 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; } }