block: Make bdrv_create_file() ':' handling consistent
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Tue, 30 Nov 2010 15:14:14 +0000 (15:14 +0000)
committerKevin Wolf <kwolf@redhat.com>
Tue, 14 Dec 2010 14:44:21 +0000 (15:44 +0100)
Filenames may start with "<protocol>:" to explicitly use a protocol like
nbd.  Filenames with unknown protocols are rejected in most of QEMU
except for bdrv_create_file().  Even if a file with an invalid filename
can be created, QEMU cannot use it since all the other relevant
functions reject such paths.  Make bdrv_create_file() consistent.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c

diff --git a/block.c b/block.c
index 63effd87699b9c656d6fe7a2405a1b67124e4c68..e7a986c48a111cfeabde278cff29be806897c44a 100644 (file)
--- a/block.c
+++ b/block.c
@@ -215,7 +215,7 @@ int bdrv_create_file(const char* filename, QEMUOptionParameter *options)
 
     drv = bdrv_find_protocol(filename);
     if (drv == NULL) {
-        drv = bdrv_find_format("file");
+        return -ENOENT;
     }
 
     return bdrv_create(drv, filename, options);