From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d16sO-000679-7K for qemu-devel@nongnu.org; Thu, 20 Apr 2017 03:51:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d16sN-0002jR-7s for qemu-devel@nongnu.org; Thu, 20 Apr 2017 03:51:40 -0400 Date: Thu, 20 Apr 2017 15:51:28 +0800 From: Fam Zheng Message-ID: <20170420075128.GD24486@lemon.lan> References: <1492661065-18510-1-git-send-email-lidongchen@tencent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1492661065-18510-1-git-send-email-lidongchen@tencent.com> Subject: Re: [Qemu-devel] [PATCH] qemu-img: check bs_n when use old style option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: jemmy858585@gmail.com Cc: qemu-devel@nongnu.org, kwolf@redhat.com, Lidong Chen , qemu-block@nongnu.org, mreitz@redhat.com On Thu, 04/20 12:04, jemmy858585@gmail.com wrote: > From: Lidong Chen > > When use old style option like -o backing_file, img_convert > continue run when bs_n > 1, this patch fix this bug. > > Signed-off-by: Lidong Chen > --- > qemu-img.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/qemu-img.c b/qemu-img.c > index b220cf7..c673aef 100644 > --- a/qemu-img.c > +++ b/qemu-img.c > @@ -2225,6 +2225,13 @@ static int img_convert(int argc, char **argv) > out_baseimg = out_baseimg_param; > } > > + if (bs_n > 1 && out_baseimg) { > + error_report("-B makes no sense when concatenating multiple input " > + "images"); > + ret = -1; > + goto out; > + } > + > /* Check if compression is supported */ > if (compress) { > bool encryption = > -- > 1.8.3.1 > > Is this essentially the same as the check a few lines above: ... if (bs_n < 1) { error_exit("Must specify image file name"); } if (bs_n > 1 && out_baseimg) { error_report("-B makes no sense when concatenating multiple input " "images"); ret = -1; goto out; } src_flags = 0; ret = bdrv_parse_cache_mode(src_cache, &src_flags, &src_writethrough); if (ret < 0) { error_report("Invalid source cache option: %s", src_cache); goto out; } ... How about moving that down? Fam