mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-02-04 15:20:41 -07:00
block: An empty filename counts as no filename
Reproducer:
$ ./qemu-img info ''
qemu-img: ./block.c:1008: bdrv_open_driver: Assertion
`!drv->bdrv_needs_filename || bs->filename[0]' failed.
[1] 26105 abort (core dumped) ./qemu-img info ''
This patch fixes this to be:
$ ./qemu-img info ''
qemu-img: Could not open '': The 'file' block driver requires a file
name
Cc: qemu-stable <qemu-stable@nongnu.org>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
312758e237
commit
4a0082401a
1 changed files with 1 additions and 1 deletions
2
block.c
2
block.c
|
|
@ -1204,7 +1204,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockBackend *file,
|
|||
filename = qdict_get_try_str(options, "filename");
|
||||
}
|
||||
|
||||
if (drv->bdrv_needs_filename && !filename) {
|
||||
if (drv->bdrv_needs_filename && (!filename || !filename[0])) {
|
||||
error_setg(errp, "The '%s' block driver requires a file name",
|
||||
drv->format_name);
|
||||
ret = -EINVAL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue