From nobody Sun May 5 00:23:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1492680060777627.9492354647103; Thu, 20 Apr 2017 02:21:00 -0700 (PDT) Received: from localhost ([::1]:52605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d18Go-000519-Ac for importer@patchew.org; Thu, 20 Apr 2017 05:20:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50598) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d18Fw-0004eC-9i for qemu-devel@nongnu.org; Thu, 20 Apr 2017 05:20:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d18Fs-0001fJ-8n for qemu-devel@nongnu.org; Thu, 20 Apr 2017 05:20:04 -0400 Received: from mail-io0-x241.google.com ([2607:f8b0:4001:c06::241]:36635) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d18Fs-0001f3-2M; Thu, 20 Apr 2017 05:20:00 -0400 Received: by mail-io0-x241.google.com with SMTP id x86so14141339ioe.3; Thu, 20 Apr 2017 02:20:00 -0700 (PDT) Received: from localhost.localdomain ([119.28.70.25]) by smtp.gmail.com with ESMTPSA id c64sm9172640pfa.110.2017.04.20.02.19.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Apr 2017 02:19:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ku7jzy2L6Ol7dxOBZAxLQGkhoIBDZrh8qZWfBopf7Kg=; b=ky9/ErpnJs3zE1i1P1pLPBy5BWc8CcC9sTwL9dk87yRYDPy1XhwKKDYxeuM2LjPGiC o+4ezkzNCiGCVeFGD9aHyfyCFT3fXjg8GIQ75s4q3CE7R6eVzoFxAvCKi4jb7f8R8XJR tNwr0mbIgrgefIymv2SDLzO8g7krvWubHbSjS9jJJalkVOQYWOvsEj7f3ez8K+fwrXTR vdAPKFtGoU1H2UjM932wRmb74cAvFVfB67dvaHY8hCgkflrDVoYhJn4QthojyvrMTwgA 36b/p8C3+j2L3Lu39I432G+NVM3fDVx7JJBAhiamLt0A2tnrsvWMjx1+VqPFeM0EpAdm v48g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ku7jzy2L6Ol7dxOBZAxLQGkhoIBDZrh8qZWfBopf7Kg=; b=M5rfEugifPRMCZkb5ovOQTfQX5wuQxn1pwBIVtDWVQlXcfk2q0oZLJrZRNwpWb+QJH 7xjBGDZvwYi4Gp1hNeFZ8O4FY/XVgDs4mK7i9XoWVxKappHO50Ih7qmctlXQTetzD9Ww Zop6NKbB4Xxr1dfEsHc1s1a/MYEg5VnJS/1PvQJUzJXR7Uku3QqxzYzr/5lhI72T/Eqt OSZSt4zByZm3QcZtQRzJtiJOKtyFDiktDhlk8EqDVlINtcdYUEpByr1/5frgOUT8gXR/ SN6UjAGQdofWDbwpBsLvHbD5DoAyOPC4mGuESHfBlADzXxa6B2ovWbUgeyxazjm1Eam5 U5pg== X-Gm-Message-State: AN3rC/6QFVVtFjsxOtXmajitKHI4pV5hbWGsxMQigZF+EEp4pAyar9+N XXu/7XqA4cOrxA== X-Received: by 10.99.45.197 with SMTP id t188mr7077730pgt.209.1492679999335; Thu, 20 Apr 2017 02:19:59 -0700 (PDT) From: jemmy858585@gmail.com X-Google-Original-From: lidongchen@tencent.com To: qemu-devel@nongnu.org Date: Thu, 20 Apr 2017 17:19:52 +0800 Message-Id: <1492679992-7805-1-git-send-email-lidongchen@tencent.com> X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c06::241 Subject: [Qemu-devel] [PATCH v2] qemu-img: check bs_n when use old style option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Lidong Chen , qemu-block@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- v2 changelog: avoid duplicating code. --- qemu-img.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index b220cf7..b4d9255 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -2108,14 +2108,6 @@ static int img_convert(int argc, char **argv) error_exit("Must specify image file name"); } =20 - - if (bs_n > 1 && out_baseimg) { - error_report("-B makes no sense when concatenating multiple input " - "images"); - ret =3D -1; - goto out; - } - src_flags =3D 0; ret =3D bdrv_parse_cache_mode(src_cache, &src_flags, &src_writethrough= ); if (ret < 0) { @@ -2225,6 +2217,13 @@ static int img_convert(int argc, char **argv) out_baseimg =3D out_baseimg_param; } =20 + if (bs_n > 1 && out_baseimg) { + error_report("Specifying backing image makes no sense when " + "concatenating multiple input images"); + ret =3D -1; + goto out; + } + /* Check if compression is supported */ if (compress) { bool encryption =3D --=20 1.8.3.1