[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/34] block: An empty filename counts as no filename
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 09/34] block: An empty filename counts as no filename |
Date: |
Fri, 28 Apr 2017 22:33:17 +0200 |
From: Max Reitz <address@hidden>
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 <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block.c b/block.c
index ceaca44..7b557f3 100644
--- a/block.c
+++ b/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;
--
1.8.3.1
- [Qemu-devel] [PULL 00/34] Block layer patches, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 02/34] file-posix: Remove unnecessary includes, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 01/34] block: Constify data passed by pointer to blk_name, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 03/34] file-win32: Remove unnecessary include, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 04/34] Revert "block/io: Comment out permission assertions", Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 06/34] migration: Call blk_resume_after_migration() for postcopy, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 05/34] qemu-img: simplify img_convert, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 08/34] qemu-iotests: Test postcopy migration, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 10/34] iotests/051: Add test for empty filename, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 09/34] block: An empty filename counts as no filename,
Kevin Wolf <=
- [Qemu-devel] [PULL 11/34] qemu-iotests: Remove PERL_PROG and BC_PROG, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 12/34] qemu_iotests: Remove _readlink(), Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 13/34] block: Remove NULL check in bdrv_co_flush, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 15/34] Issue a deprecation warning if the user specifies the "-hdachs" option., Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 14/34] iotests: Launch qemu-nbd with -e 42, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 16/34] iotests: Fix typo in 026, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 18/34] block: Do not unref bs->file on error in BD's open, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 17/34] iotests: 109: Filter out "len" of failed jobs, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 19/34] block: fix alignment calculations in bdrv_co_do_zero_pwritev, Kevin Wolf, 2017/04/28