diff mbox

block: fix the use of protocols in backing files (v2)

Message ID 1288208649-27542-1-git-send-email-aliguori@us.ibm.com
State New
Headers show

Commit Message

Anthony Liguori Oct. 27, 2010, 7:44 p.m. UTC
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2
 - Fix up CODING_STYLE of modified code

Comments

Kevin Wolf Oct. 28, 2010, 8:58 a.m. UTC | #1
Am 27.10.2010 21:44, schrieb Anthony Liguori:
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Thanks, added a meaningful commit message and applied to the block branch.

Kevin
diff mbox

Patch

diff --git a/block.c b/block.c
index 1a965b2..029017e 100644
--- a/block.c
+++ b/block.c
@@ -603,10 +603,17 @@  int bdrv_open(BlockDriverState *bs, const char *filename, int flags,
         BlockDriver *back_drv = NULL;
 
         bs->backing_hd = bdrv_new("");
-        path_combine(backing_filename, sizeof(backing_filename),
-                     filename, bs->backing_file);
-        if (bs->backing_format[0] != '\0')
-            back_drv = bdrv_find_format(bs->backing_format);
+        back_drv = bdrv_find_protocol(bs->backing_file);
+        if (!back_drv) {
+            path_combine(backing_filename, sizeof(backing_filename),
+                         filename, bs->backing_file);
+            if (bs->backing_format[0] != '\0') {
+                back_drv = bdrv_find_format(bs->backing_format);
+            }
+        } else {
+            pstrcpy(backing_filename, sizeof(backing_filename),
+                    bs->backing_file);
+        }
 
         /* backing files always opened read-only */
         back_flags =