From patchwork Wed Mar 3 12:06:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 46790 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 32667B7CC1 for ; Wed, 3 Mar 2010 23:13:28 +1100 (EST) Received: from localhost ([127.0.0.1]:32774 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmnS8-00035Y-KB for incoming@patchwork.ozlabs.org; Wed, 03 Mar 2010 07:13:24 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NmnM3-0000kT-No for qemu-devel@nongnu.org; Wed, 03 Mar 2010 07:07:07 -0500 Received: from [199.232.76.173] (port=53669 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmnM2-0000k7-Va for qemu-devel@nongnu.org; Wed, 03 Mar 2010 07:07:06 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NmnM1-0005Hv-It for qemu-devel@nongnu.org; Wed, 03 Mar 2010 07:07:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:11197) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NmnM1-0005Ho-6r for qemu-devel@nongnu.org; Wed, 03 Mar 2010 07:07:05 -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 o23C74fI007078 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 3 Mar 2010 07:07:04 -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 o23C71A5004209; Wed, 3 Mar 2010 07:07:03 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 3 Mar 2010 13:06:51 +0100 Message-Id: <001703bb3cac98fecb6d5003c8604d350931c3d3.1267617582.git.quintela@redhat.com> 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 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;