From patchwork Thu Dec 13 15:10:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 206172 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CF11C2C009A for ; Fri, 14 Dec 2012 04:03:25 +1100 (EST) Received: from localhost ([::1]:51637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjAT2-0002EP-SO for incoming@patchwork.ozlabs.org; Thu, 13 Dec 2012 10:12:56 -0500 Received: from eggs.gnu.org ([208.118.235.92]:37059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjARP-0007qi-6J for qemu-devel@nongnu.org; Thu, 13 Dec 2012 10:11:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TjARJ-0005w4-Av for qemu-devel@nongnu.org; Thu, 13 Dec 2012 10:11:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59691) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjARJ-0005vp-2f for qemu-devel@nongnu.org; Thu, 13 Dec 2012 10:11:09 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBDFB7oR017692 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 13 Dec 2012 10:11:08 -0500 Received: from dhcp-5-188.str.redhat.com (dhcp-200-232.str.redhat.com [10.33.200.232]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id qBDFApmT026810; Thu, 13 Dec 2012 10:11:07 -0500 From: Kevin Wolf To: anthony@codemonkey.ws Date: Thu, 13 Dec 2012 16:10:21 +0100 Message-Id: <1355411450-12761-15-git-send-email-kwolf@redhat.com> In-Reply-To: <1355411450-12761-1-git-send-email-kwolf@redhat.com> References: <1355411450-12761-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 14/43] qemu-img: img_create(): pass Error object to bdrv_img_create() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Luiz Capitulino Signed-off-by: Luiz Capitulino Signed-off-by: Kevin Wolf --- qemu-img.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 3896689..595b6f5 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -301,6 +301,7 @@ static int img_create(int argc, char **argv) const char *filename; const char *base_filename = NULL; char *options = NULL; + Error *local_err = NULL; for(;;) { c = getopt(argc, argv, "F:b:f:he6o:"); @@ -361,8 +362,14 @@ static int img_create(int argc, char **argv) goto out; } - ret = bdrv_img_create(filename, fmt, base_filename, base_fmt, - options, img_size, BDRV_O_FLAGS, NULL); + bdrv_img_create(filename, fmt, base_filename, base_fmt, + options, img_size, BDRV_O_FLAGS, &local_err); + if (error_is_set(&local_err)) { + error_report("%s", error_get_pretty(local_err)); + error_free(local_err); + ret = -1; + } + out: if (ret) { return 1;