From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=50784 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PTCeo-0006Wh-Q4 for qemu-devel@nongnu.org; Thu, 16 Dec 2010 07:10:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PTCJE-0007g2-AC for qemu-devel@nongnu.org; Thu, 16 Dec 2010 06:47:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PTCJE-0007fc-3e for qemu-devel@nongnu.org; Thu, 16 Dec 2010 06:47:44 -0500 Message-ID: <4D09FC9D.1090502@redhat.com> Date: Thu, 16 Dec 2010 12:48:45 +0100 From: Kevin Wolf MIME-Version: 1.0 References: <1292497454-32573-1-git-send-email-Jes.Sorensen@redhat.com> <1292497454-32573-4-git-send-email-Jes.Sorensen@redhat.com> In-Reply-To: <1292497454-32573-4-git-send-email-Jes.Sorensen@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 3/3] Prevent creating an image with the same filename as backing file List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jes.Sorensen@redhat.com Cc: qemu-devel@nongnu.org, armbru@redhat.com, stefanha@linux.vnet.ibm.com Am 16.12.2010 12:04, schrieb Jes.Sorensen@redhat.com: > From: Jes Sorensen > > Signed-off-by: Jes Sorensen > --- > block.c | 7 +++++++ > 1 files changed, 7 insertions(+), 0 deletions(-) > > diff --git a/block.c b/block.c > index 765f9f3..027dc6a 100644 > --- a/block.c > +++ b/block.c > @@ -2769,6 +2769,13 @@ int bdrv_img_create(const char *filename, const char *fmt, > BlockDriver *drv, *proto_drv; > int ret = 0; > > + if (!strcmp(filename, base_filename)) { > + error_report("Error: Trying to create a snapshot with the same " > + "filename as the backing file"); > + ret = -1; > + goto out; > + } > + > /* Find driver and parse its options */ > drv = bdrv_find_format(fmt); > if (!drv) { This doesn't catch things like qemu-img create -f qcow2 -obacking_file=foo.qcow2 foo.qcow2 though it will work if you use the legacy -b option. I think we should keep it consistent. Kevin