Received: from eggs.gnu.org ([2001:4830:134:3::10]:53783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCluH-0006BX-QC for qemu-devel@nongnu.org; Mon, 10 Feb 2014 03:08:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCluB-0000Su-Ht for qemu-devel@nongnu.org; Mon, 10 Feb 2014 03:07:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49713) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCluB-0000Sq-9E for qemu-devel@nongnu.org; Mon, 10 Feb 2014 03:07:51 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1A87osi018026 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 10 Feb 2014 03:07:50 -0500 Date: Mon, 10 Feb 2014 16:07:57 +0800 From: Fam Zheng Message-ID: <20140210080757.GL15707@T430.nay.redhat.com> References: <1391939335-31580-1-git-send-email-pbonzini@redhat.com> <1391939335-31580-11-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1391939335-31580-11-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH 10/20] curl: correctly propagate errors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, mreitz@redhat.com On Sun, 02/09 10:48, Paolo Bonzini wrote: > 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\n", > + s->readahead_size); Getting rid of the inconsistency of fprintf(stderr,...)'s are good! > 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 > > > Thanks, Reviewed-by: Fam Zheng