qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/3] Prevent creating an image with the same filenam


From: Jes . Sorensen
Subject: [Qemu-devel] [PATCH 3/3] Prevent creating an image with the same filename as backing file
Date: Mon, 13 Dec 2010 08:32:59 +0100

From: Jes Sorensen <address@hidden>

Signed-off-by: Jes Sorensen <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]