From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42852 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PS2uD-00063p-AT for qemu-devel@nongnu.org; Mon, 13 Dec 2010 02:33:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PS2uB-00040i-JE for qemu-devel@nongnu.org; Mon, 13 Dec 2010 02:33:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37759) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PS2uB-00040I-AT for qemu-devel@nongnu.org; Mon, 13 Dec 2010 02:33:07 -0500 From: Jes.Sorensen@redhat.com Date: Mon, 13 Dec 2010 08:32:59 +0100 Message-Id: <1292225579-27320-4-git-send-email-Jes.Sorensen@redhat.com> In-Reply-To: <1292225579-27320-1-git-send-email-Jes.Sorensen@redhat.com> References: <1292225579-27320-1-git-send-email-Jes.Sorensen@redhat.com> Subject: [Qemu-devel] [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: kwolf@redhat.com Cc: qemu-devel@nongnu.org, armbru@redhat.com, stefanha@linux.vnet.ibm.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 3ab062c..403a434 100644 --- a/block.c +++ b/block.c @@ -2752,6 +2752,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) { -- 1.7.3.2