From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCR0z-0008Sf-B5 for qemu-devel@nongnu.org; Sun, 09 Feb 2014 04:49:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCR0q-0007jp-TG for qemu-devel@nongnu.org; Sun, 09 Feb 2014 04:49:29 -0500 Received: from mail-ea0-x22f.google.com ([2a00:1450:4013:c01::22f]:61139) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCR0q-0007jZ-M4 for qemu-devel@nongnu.org; Sun, 09 Feb 2014 04:49:20 -0500 Received: by mail-ea0-f175.google.com with SMTP id z10so2390672ead.34 for ; Sun, 09 Feb 2014 01:49:19 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Sun, 9 Feb 2014 10:48:44 +0100 Message-Id: <1391939335-31580-10-git-send-email-pbonzini@redhat.com> In-Reply-To: <1391939335-31580-1-git-send-email-pbonzini@redhat.com> References: <1391939335-31580-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 09/20] cow: correctly propagate errors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, mreitz@redhat.com Signed-off-by: Paolo Bonzini --- block/cow.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/block/cow.c b/block/cow.c index 7fc0b12..43a2150 100644 --- a/block/cow.c +++ b/block/cow.c @@ -82,7 +82,7 @@ static int cow_open(BlockDriverState *bs, QDict *options, int flags, char version[64]; snprintf(version, sizeof(version), "COW version %d", cow_header.version); - qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, + error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, bs->device_name, "cow", version); ret = -ENOTSUP; goto fail; @@ -330,7 +330,6 @@ static int cow_create(const char *filename, QEMUOptionParameter *options, struct stat st; int64_t image_sectors = 0; const char *image_filename = NULL; - Error *local_err = NULL; int ret; BlockDriverState *cow_bs; @@ -344,18 +343,13 @@ static int cow_create(const char *filename, QEMUOptionParameter *options, options++; } - ret = bdrv_create_file(filename, options, &local_err); + ret = bdrv_create_file(filename, options, errp); if (ret < 0) { - qerror_report_err(local_err); - error_free(local_err); return ret; } - ret = bdrv_file_open(&cow_bs, filename, NULL, NULL, BDRV_O_RDWR, - &local_err); + ret = bdrv_file_open(&cow_bs, filename, NULL, NULL, BDRV_O_RDWR, errp); if (ret < 0) { - qerror_report_err(local_err); - error_free(local_err); return ret; } -- 1.8.5.3