From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFOV8-0000iq-39 for qemu-devel@nongnu.org; Mon, 17 Feb 2014 08:44:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFOUz-00013g-FP for qemu-devel@nongnu.org; Mon, 17 Feb 2014 08:44:49 -0500 Received: from mail-qg0-x232.google.com ([2607:f8b0:400d:c04::232]:64434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFOUz-00013c-Aw for qemu-devel@nongnu.org; Mon, 17 Feb 2014 08:44:41 -0500 Received: by mail-qg0-f50.google.com with SMTP id z60so4950645qgd.9 for ; Mon, 17 Feb 2014 05:44:40 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 17 Feb 2014 14:43:57 +0100 Message-Id: <1392644647-9897-11-git-send-email-pbonzini@redhat.com> In-Reply-To: <1392644647-9897-1-git-send-email-pbonzini@redhat.com> References: <1392644647-9897-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH v3 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, jcody@redhat.com, famz@redhat.com, stefanha@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..7edb3cc 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