diff mbox

[3/5] block/raw-posix: Strip "file:" prefix on creation

Message ID 1394055700-5988-4-git-send-email-mreitz@redhat.com
State New
Headers show

Commit Message

Max Reitz March 5, 2014, 9:41 p.m. UTC
The bdrv_create() implementation of the block/raw-posix "file" protocol
driver should strip the "file:" prefix from filenames if present.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 block/raw-posix.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Benoît Canet March 6, 2014, 1:04 p.m. UTC | #1
The Wednesday 05 Mar 2014 à 22:41:38 (+0100), Max Reitz wrote :
> The bdrv_create() implementation of the block/raw-posix "file" protocol
> driver should strip the "file:" prefix from filenames if present.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  block/raw-posix.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/block/raw-posix.c b/block/raw-posix.c
> index 892145c..e6b4c1f 100644
> --- a/block/raw-posix.c
> +++ b/block/raw-posix.c
> @@ -1241,6 +1241,8 @@ static int raw_create(const char *filename, QEMUOptionParameter *options,
>      int result = 0;
>      int64_t total_size = 0;
>  
> +    strstart(filename, "file:", &filename);
> +
>      /* Read out options */
>      while (options && options->name) {
>          if (!strcmp(options->name, BLOCK_OPT_SIZE)) {
> -- 
> 1.9.0
> 
> 
Reviewed-by: Benoit Canet <benoit@irqsave.net>
diff mbox

Patch

diff --git a/block/raw-posix.c b/block/raw-posix.c
index 892145c..e6b4c1f 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1241,6 +1241,8 @@  static int raw_create(const char *filename, QEMUOptionParameter *options,
     int result = 0;
     int64_t total_size = 0;
 
+    strstart(filename, "file:", &filename);
+
     /* Read out options */
     while (options && options->name) {
         if (!strcmp(options->name, BLOCK_OPT_SIZE)) {