From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDGl4-0007bF-Va for qemu-devel@nongnu.org; Tue, 11 Feb 2014 12:04:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WDGkw-0008GX-BJ for qemu-devel@nongnu.org; Tue, 11 Feb 2014 12:04:30 -0500 Received: from mail-qc0-x22f.google.com ([2607:f8b0:400d:c01::22f]:46464) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDGkw-0008GQ-7D for qemu-devel@nongnu.org; Tue, 11 Feb 2014 12:04:22 -0500 Received: by mail-qc0-f175.google.com with SMTP id x13so13488748qcv.34 for ; Tue, 11 Feb 2014 09:04:21 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 11 Feb 2014 18:03:43 +0100 Message-Id: <1392138233-26407-11-git-send-email-pbonzini@redhat.com> In-Reply-To: <1392138233-26407-1-git-send-email-pbonzini@redhat.com> References: <1392138233-26407-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH v2 10/20] curl: correctly propagate errors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, famz@redhat.com Signed-off-by: Paolo Bonzini --- block/curl.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/block/curl.c b/block/curl.c index a807584..353bab1 100644 --- a/block/curl.c +++ b/block/curl.c @@ -456,30 +456,27 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags, static int inited = 0; if (flags & BDRV_O_RDWR) { - qerror_report(ERROR_CLASS_GENERIC_ERROR, - "curl block device does not support writes"); + error_setg(errp, "curl block device does not support writes"); return -EROFS; } opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (error_is_set(&local_err)) { - qerror_report_err(local_err); - error_free(local_err); + error_propagate(errp, local_err); goto out_noclean; } s->readahead_size = qemu_opt_get_size(opts, "readahead", READ_AHEAD_SIZE); if ((s->readahead_size & 0x1ff) != 0) { - fprintf(stderr, "HTTP_READAHEAD_SIZE %zd is not a multiple of 512\n", - s->readahead_size); + error_setg(errp, "HTTP_READAHEAD_SIZE %zd is not a multiple of 512", + s->readahead_size); goto out_noclean; } file = qemu_opt_get(opts, "url"); if (file == NULL) { - qerror_report(ERROR_CLASS_GENERIC_ERROR, "curl block driver requires " - "an 'url' option"); + error_setg(errp, "curl block driver requires an 'url' option"); goto out_noclean; } -- 1.8.5.3