From patchwork Thu Mar 4 09:00:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 46892 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 C76F3B7CE8 for ; Thu, 4 Mar 2010 20:20:04 +1100 (EST) Received: from localhost ([127.0.0.1]:58914 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nn7Dl-0005td-G5 for incoming@patchwork.ozlabs.org; Thu, 04 Mar 2010 04:19:53 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nn6vQ-0003sI-4t for qemu-devel@nongnu.org; Thu, 04 Mar 2010 04:00:56 -0500 Received: from [199.232.76.173] (port=45408 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nn6vO-0003rk-8K for qemu-devel@nongnu.org; Thu, 04 Mar 2010 04:00:54 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nn6vI-0004QM-3z for qemu-devel@nongnu.org; Thu, 04 Mar 2010 04:00:53 -0500 Received: from mx20.gnu.org ([199.232.41.8]:61568) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Nn6vH-0004Q2-SU for qemu-devel@nongnu.org; Thu, 04 Mar 2010 04:00:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nn6vG-00087G-TX for qemu-devel@nongnu.org; Thu, 04 Mar 2010 04:00:47 -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 o2490hYJ002203 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 4 Mar 2010 04:00:44 -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 o2490etU010016; Thu, 4 Mar 2010 04:00:42 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 4 Mar 2010 10:00:30 +0100 Message-Id: <001703bb3cac98fecb6d5003c8604d350931c3d3.1267692963.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-detected-operating-system: by mx20.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Subject: [Qemu-devel] [PATCH 01/10] cow: 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 Remove not needed ret = 0 assignment. Signed-off-by: Juan Quintela --- block/cow.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/block/cow.c b/block/cow.c index 3733385..97e9745 100644 --- a/block/cow.c +++ b/block/cow.c @@ -224,7 +224,7 @@ static int cow_create(const char *filename, QEMUOptionParameter *options) cow_fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); if (cow_fd < 0) - return -1; + return -errno; memset(&cow_header, 0, sizeof(cow_header)); cow_header.magic = cpu_to_be32(COW_MAGIC); cow_header.version = cpu_to_be32(COW_VERSION); @@ -251,7 +251,7 @@ static int cow_create(const char *filename, QEMUOptionParameter *options) cow_header.size = cpu_to_be64(image_sectors * 512); ret = qemu_write_full(cow_fd, &cow_header, sizeof(cow_header)); if (ret != sizeof(cow_header)) { - ret = -1; + ret = -errno; goto exit; } @@ -262,7 +262,6 @@ static int cow_create(const char *filename, QEMUOptionParameter *options) goto exit; } - ret = 0; exit: close(cow_fd); return ret;